
// Install required packages

/*
 
ssc install estout, replace 
ssc install parmest, replace
ssc install blindschemes, replace 
ssc install addplot, replace
ssc install ebalance, replace
ssc install coefplot, replace
ssc install addplot, replace
net install dm79.pkg, from(http://www.stata.com/stb/stb56)
net install dm49.pkg, from(http://www.stata.com/stb/stb39)
net install grc1leg2.pkg, from(http://digital.cgdev.org/doc/stata/MO/Misc)
net install rddensity, from("https://raw.githubusercontent.com/rdpackages/rddensity/master/stata") replace
ssc install rdrobust

*/

// Open log
log using log, replace text

// Set globals
global bandwidth "bandwidth"
global figures "figures"
global tables "tables"

// Globals for dropping observations before the tax day
gl drop5 "rv != -5 & rv != -4 & rv != -3 & rv != -2 & rv != -1"
gl drop4 "rv != -4 & rv != -3 & rv != -2 & rv != -1"
gl drop3 "rv != -3 & rv != -2 & rv != -1"
gl drop2 "rv != -2 & rv != -1"
gl drop1 "rv != -2 & rv != -1"

********************************************************************************
**					Inequality trends (Finland, EU, US)						  **
********************************************************************************

// Inequality data downloaded from https://wid.world/data/ on Jan 14, 2021

// Top 10%
clear
import delimited "WID_Data_14012021-095950.csv", delimiter(";")
drop in 1/11
ren v2 year
ren v3 finland
lab var finland "Share of pre-tax income of top 10% adults (Finland)"
ren v4 europe
lab var europe "Share of pre-tax income of top 10% adults (EU)"
ren v5 usa
lab var usa "Share of pre-tax income of top 10% adults (USA)"
drop v1
destring, replace

// Graph
twoway 	(line finland year) ///
		(line europe year, lp(dash)) ///
		(line usa year, lp(dash_dot)), ///
		legend(pos(5) ring(0) row(1) order(1 "Finland" 2 "EU" 3 "US") region(fcolor(white))) ///
		graphregion(color(white)) ///
		xscale(range(1980(4)2018)) ///
		xla(1980(6)2018) ///
		xtitle("Year", margin(small) size(*1.15)) ///
		yscale(range(.1(.05).5)) ///
		yla(.1(.05).5) ///
		ytitle("Top 10% income share", margin(small) size(*1.15)) ///
		title("Top 10%", c(black))
		
graph save "$figures/inequality_top10.gph", replace

// Bottom 50%
clear
import delimited "WID_Data_11022021-093123.csv", delimiter(";")
drop in 1/11
ren v2 year
ren v3 finland
lab var finland "Share of pre-tax income of bottom 50% adults (Finland)"
ren v4 europe
lab var europe "Share of pre-tax income of bottom 50% adults (EU)"
ren v5 usa
lab var usa "Share of pre-tax income of bottom 50% adults (USA)"
drop v1
destring, replace

// Graph
twoway 	(line finland year) ///
		(line europe year, lp(dash)) ///
		(line usa year, lp(dash_dot)), ///
		legend(pos(5) ring(0) row(1) order(1 "Finland" 2 "EU" 3 "US") region(fcolor(white))) ///
		graphregion(color(white)) ///
		xscale(range(1980(4)2018)) ///
		xla(1980(6)2018) ///
		xtitle("Year", margin(small) size(*1.15)) ///
		yscale(range(.1(.05).5)) ///
		yla(.1(.05).5) ///
		ytitle("Bottom 50% income share", margin(small) size(*1.15)) ///
		title("Bottom 50%", c(black))
		
graph save "$figures/inequality_bottom50.gph", replace

// FIGURE A6

cd "$figures"
grc1leg2 inequality_top10.gph inequality_bottom50.gph, col(2) graphregion(margin(zero) color(white)) legendfrom(inequality_top10.gph) lsize(small)
graph export "figureA6.pdf", replace
erase "inequality_top10.gph"
erase "inequality_bottom50.gph"
cd ..

********************************************************************************
**								Media graphs								  **
********************************************************************************

// Media hits data are from VATT Institute for Economic Research (Helsinki)
// Google search data are from Google Trends, downloaded on 19 Feb 2021

use "media.dta", clear
tsset date, daily

// Graph tulot, palkat, palkka (income, wages, salary)
twoway 	tsline hits_palkat, lc(black) ///
		tlabel(, format(%tdmd)) ///
		graphregion(color(white)) ///
		yla(0(250)1000) ///
		xtitle("", margin(small)) ///
		ytitle("Daily hits", margin(small) size(*1.15)) ///
		title("Keywords: income, wages, salary", c(black))
		
graph save "$figures/media_palkat.gph", replace


// Graph tuloero, tuloerot (income difference, income differences)
twoway 	tsline hits_tuloero, lc(black) ///
		tlabel(, format(%tdmd)) ///
		graphregion(color(white)) ///
		yscale(range(0(10)45)) ///
		yla(0(10)40) ///
		xtitle("", margin(small)) ///
		ytitle("Daily hits", margin(small) size(*1.15)) ///
		title("Keywords: income difference, income differences", c(black))
		
graph save "$figures/media_tuloero.gph", replace

// FIGURE 1
cd "$figures"
graph combine media_palkat.gph media_tuloero.gph, rows(2) graphregion(margin(zero) color(white))
graph export "figure1.pdf", replace
erase "media_palkat.gph"
erase "media_tuloero.gph"

cd ..

// FIGURE A7 - Google searches (earned income taxes)
twoway 	tsline search_taxes, lc(black) ///
		tlabel(, format(%tdmd)) ///
		graphregion(color(white)) ///
		xtitle("", margin(small)) ///
		ytitle("Daily search interest relative to highest interest", margin(small) size(*1.15)) ///
		title("Topic: earned income taxes", c(black))
graph export "$figures/figureA7.pdf", replace


		
********************************************************************************
**					 			Descriptives								  **
********************************************************************************

use "ess_finland.dta", clear

// Correlation between prefs for redistribution and income (reported in the "Background" section of the paper)
pwcorr gincdif hinctnta_combined, sig

// Number of interviews per weekday
hist weekday, 	d w(.5) col(gs8) fc(gs12) freq graphregion(color(white)) ///
				xtitle("Weekday of interview", margin(small) size(*1.15)) ///
				ytitle("Number of respondents", margin(small) size(*1.15)) ///
				yscale(range(0(1000)4040)) ylab(0(1000)4040) ///
				xla(1/7, valuelabel noticks) ///
				legend(off)
				graph save "$figures/hist_weekday.gph", replace

// Density plot of the running variable
hist rv, 	w(1) col(gs8) fc(gs12) freq graphregion(color(white)) ///
			xtitle("Days before / after the tax day", margin(vsmall) size(*1.15)) ///
			ytitle("", margin(small) size(*1.15)) ///
			yscale(range(0(100)404)) ylab(0(100)404) ///
			addplot(pci 0 0 404 0, lc(black) lp(shortdash) lw(thin)) ///
			legend(off)
			graph save "$figures/hist_rv.gph", replace

// FIGURE 2				
clear
cd "$figures"
graph combine	hist_weekday.gph hist_rv.gph, ///
				graphregion(margin(zero) color(white)) ysize(3.5)
graph export "figure2.pdf", replace
erase "hist_weekday.gph"
erase "hist_rv.gph"	

// FIGURE A9
// Density plot of the running variable (zoomed in on 40 days around tax day)
cd ..
use "ess_finland.dta", clear
hist rv if abs(rv)<= 40,	w(1) col(gs8) fc(gs12) freq graphregion(color(white)) ///
							xtitle("Days before / after the tax day", margin(vsmall) size(*1.15)) ///
							ytitle("Number of respondents", margin(small) size(*1.15)) ///
							yscale(range(0(100)404)) ylab(0(100)404) ///
							xscale(range(-40(10)40)) xlab(-40(10)40) ///
							addplot(pci 0 0 400 0, lc(black) lp(shortdash) lw(thin)) ///
							legend(off)
							graph export "$figures/figureA9.pdf", replace
				
// FIGURE A10
// Plot interview attempts by interview date (ESS4-9)				
reg rv attempts_to_survey
	local coef = _b[attempts_to_survey]
	local tval = _b[attempts_to_survey]/_se[attempts_to_survey]
	local coef = round(`coef', .01)
	local tval = round(`tval', .001)
	lpoly rv attempts_to_survey, ///
			kernel(gau) ci noscatter legend(off) ///
			xscale(range(1(5)30)) xlab(1(4)30) ///
			yscale(range(-20(10)140)) ylab(-20(20)140) ///
			ytitle("Interview day relative to tax day") ///
			xtitle("Number of interview attempts") ///
			title("") ///
			graphregion(color(white)) ///
			note("Coefficient = `coef'  t-statistic = `tval'") 
			graph export "$figures/figureA10.pdf", replace

// TABLE 1	
// Summary stats for main DVs
lab var gincdif "Support for redistribution"
lab var topinfr_new "Top 10\% incomes unfairly high"
eststo clear
xi: estpost summarize gincdif topinfr_new 
esttab using "$tables/table1.tex", replace ///
    cells("count(fmt(a2)) mean sd min max") label ///
	nomtitle nonumber noobs
eststo clear


// FIGURE A11
// Density plot of main outcome variable (support for redistribution)
hist gincdif, 	col(gs8) fc(gs12) freq graphregion(color(white)) ///
				xtitle("Support for redistribution", margin(small) size(*1.15)) ///
				ytitle("Number of respondents", margin(small) size(*1.15)) ///
				legend(off)
				graph export "$figures/figureA11.pdf", replace	

// Life satisfaction (probit-adjusted and standardised)
tabstat stpols_stflife, s(n mean sd min max)
tab stpols_stflife

// FIGURE A12
// Density plot of life satisfaction (probit-adjusted and standardised)
hist stpols_stflife, 	col(gs8) fc(gs12) freq graphregion(color(white)) ///
						xtitle("Life satisfaction (Probit-OLS adjusted & standardised)", margin(small) size(*1.15)) ///
						ytitle("Number of respondents", margin(small) size(*1.15)) ///
						legend(off)
						graph export "$figures/figureA12.pdf", replace	

/*						
// Mean support for redistribution by age group
tabstat gincdif, s(mean median sd min max) by(agegroup)
reg gincdif i.agegroup

* Lowest and least variable amongst youngest age group
* Relationship between age group and support for redistr is statistically significant

// Mean household income decile by age group
tabstat hinctnta_combined, s(mean median sd min max) by(agegroup)
reg hinctnta_combined i.agegroup

** all age groups have higher average household income than the youngest age group (15-24)
** except for the oldest age group (75-100).
** The relationship between income decile and age group is statistically signifcant
*/

// Mean in paid work by age group (reported in Appendix A3)
tabstat pdwrk, s(mean median sd min max) by(agegroup)
reg pdwrk i.agegroup

** all age groups are more likely to be in paid employment than the youngest age group (15-24)
** except for the oldest two age groups (65-74 and 75-100).
** The relationship between age group and being in paid work is statistically signifcant


********************************************************************************
**						FIGURE 3: UNFAIRNESS PERCEPTIONS					  **
********************************************************************************

// BELOW MEDIAN

use "ess_finland.dta", clear
cd "$bandwidth"

// erase any existing dta files in this directory

local list : dir . files "*.dta"
foreach f of local list {
    erase "`f'"
}

// keep only below median income earners

keep if bmedian == 1

forvalues c = 5(1)30 {
	local k=`c'
	reg topinfr_new i.treated##c.rv i.essround if abs(rv)<=`c' & $drop3
	parmest, saving(bandwidth`c'.dta, replace)
	}

forvalues i = 5(1)30 {
	use bandwidth`i'.dta, clear
	gen bandwidth = `i'
	drop if parm!="1.treated"
	save, replace
	}

use bandwidth5.dta, clear
forvalues i = 6(1)30 {
	append using bandwidth`i'.dta
	}

twoway 	(rline min95 max95 bandwidth, ylabel(, format(%12.0g)) lpattern(dash) lcolor(gray) ///
		yline(0, lcolor(black) lwidth(vthin)) lwidth(med) ///
		yscale(range(-10(10)30)) ylab(-10(10)30) ///
		xaxis(1) xlabel(5(5)30, axis(1) format(%3.0f)) ///
		xline(10, lcolor(cranberry)) ///
		subtitle("Below-median income") legend(off) ///
		xtitle("Bandwidth (days)", axis(1)) ///
		ytitle("Effect on unfairness perception (1-9)") ///
		graphregion(color(white))) ///
		(scatter estimate bandwidth, connect(direct) lwidth(med) lcolor(black) msymbol(none))

		cd ..
		graph save "$figures/topinf_poor.gph", replace

// ABOVE MEDIAN

use "ess_finland.dta", clear
cd "$bandwidth"
keep if bmedian == 0

forvalues c = 5(1)30 {
	local k=`c'
	reg topinfr_new i.treated##c.rv i.essround if abs(rv)<=`c' & $drop3
	parmest, saving(bandwidth`c'.dta, replace)
	}

forvalues i = 5(1)30 {
	use bandwidth`i'.dta, clear
	gen bandwidth = `i'
	drop if parm!="1.treated"
	save, replace
	}

use bandwidth5.dta, clear
forvalues i = 6(1)30 {
	append using bandwidth`i'.dta
	}

twoway 	(rline min95 max95 bandwidth, ylabel(, format(%12.0g)) lpattern(dash) lcolor(gray) ///
		yline(0, lcolor(black) lwidth(vthin)) lwidth(med) ///
		yscale(range(-10(10)30)) ylab(-10(10)30) ///
		xaxis(1) xlabel(5(5)30, axis(1) format(%3.0f)) ///
		xline(10, lcolor(cranberry)) ///
		subtitle("Above-median income") legend(off) ///
		xtitle("Bandwidth (days)", axis(1)) ///
		ytitle("Effect on unfairness perception (1-9)") ///
		graphregion(color(white))) ///
		(scatter estimate bandwidth, connect(direct) lwidth(med) lcolor(black) msymbol(none))

		cd ..
		graph save "$figures/topinf_rich.gph", replace

// Combine graphs

cd "$figures"
gr combine topinf_poor.gph topinf_rich.gph, row(2) graphregion(margin(zero) color(white)) ysize(6.5)
graph export "figure3.pdf", replace
erase "topinf_poor.gph"
erase "topinf_rich.gph"

// erase bandwidth data files
cd ..
cd "$bandwidth"
local list : dir . files "*.dta"
foreach f of local list {
    erase "`f'"
}

		
********************************************************************************
**							SUPPORT FOR REDISTRIBUTION						  **
********************************************************************************				
				
// Effect of tax day by income decile
				
cd ..
use "ess_finland.dta", clear
cd "$tables"

// TABLE A7
// support for redistribution by income group for results table in the appendix
bysort hinctnta_combined: sum gincdif if abs(rv)<=10 & $drop3

eststo clear

quietly reg gincdif i.treated##c.rv i.essround if abs(rv)<=10 & $drop3 & hinctnta_combined==1
estimates store m1
outreg2 using tableA7, replace tex dec(3) pdec(3) keep(1.treated rv 1.treated#c.rv)

quietly reg gincdif i.treated##c.rv i.essround if abs(rv)<=10 & $drop3 & hinctnta_combined==2
estimates store m2
outreg2 using tableA7, append tex dec(3) pdec(3) keep(1.treated rv 1.treated#c.rv)

quietly reg gincdif i.treated##c.rv i.essround if abs(rv)<=10 & $drop3 & hinctnta_combined==3
estimates store m3
outreg2 using tableA7, append tex dec(3) pdec(3) keep(1.treated rv 1.treated#c.rv)

quietly reg gincdif i.treated##c.rv i.essround if abs(rv)<=10 & $drop3 & hinctnta_combined==4
estimates store m4
outreg2 using tableA7, append tex dec(3) pdec(3) keep(1.treated rv 1.treated#c.rv)

quietly reg gincdif i.treated##c.rv i.essround if abs(rv)<=10 & $drop3 & hinctnta_combined==5
estimates store m5
outreg2 using tableA7, append tex dec(3) pdec(3) keep(1.treated rv 1.treated#c.rv)

quietly reg gincdif i.treated##c.rv i.essround if abs(rv)<=10 & $drop3 & hinctnta_combined==6
estimates store m6
outreg2 using tableA7, append tex dec(3) pdec(3) keep(1.treated rv 1.treated#c.rv)

quietly reg gincdif i.treated##c.rv i.essround if abs(rv)<=10 & $drop3 & hinctnta_combined==7
estimates store m7
outreg2 using tableA7, append tex dec(3) pdec(3) keep(1.treated rv 1.treated#c.rv)

quietly reg gincdif i.treated##c.rv i.essround if abs(rv)<=10 & $drop3 & hinctnta_combined==8
estimates store m8
outreg2 using tableA7, append tex dec(3) pdec(3) keep(1.treated rv 1.treated#c.rv)

quietly reg gincdif i.treated##c.rv i.essround if abs(rv)<=10 & $drop3 & hinctnta_combined==9
estimates store m9
outreg2 using tableA7, append tex dec(3) pdec(3) keep(1.treated rv 1.treated#c.rv)

reg gincdif i.treated##c.rv i.essround if abs(rv)<=10 & $drop3 & hinctnta_combined==10
estimates store m10
outreg2 using tableA7, append tex dec(3) pdec(3) keep(1.treated rv 1.treated#c.rv)


// FIGURE 4

coefplot(m1, mcolor(black) ciopts(lcolor(black black))) ///
		(m2, mcolor(black) ciopts(lcolor(black black))) ///
		(m3, mcolor(black) ciopts(lcolor(black black))) ///
		(m4, mcolor(black) ciopts(lcolor(black black))) ///
		(m5, mcolor(black) ciopts(lcolor(black black))) ///
		(m6, mcolor(black) ciopts(lcolor(black black))) ///
		(m7, mcolor(black) ciopts(lcolor(black black))) ///
		(m8, mcolor(black) ciopts(lcolor(black black))) ///
		(m9, mcolor(black) ciopts(lcolor(black black))) ///
		(m10, mcolor(black) ciopts(lcolor(black black))), ///
		vertical ///
		keep(1.treated) ///
		yline(0, lcolor(black) lwidth(thin) lpattern(dash)) ///
		graphregion(fcolor(white)) bgcolor(white) ///
		legend(off) ///
		ytitle("Effect on support for redistribution (1-5)", margin(r=2)) ///
		xtitle("Income decile", margin(t=2)) ///
		xlabel(0.6 "1" 0.688 "2" 0.776 "3" 0.864 "4" 0.952 "5" 1.04 "6" 1.128 "7" 1.216 "8" 1.304 "9" 1.4 "10", noticks labgap(*3))
		
		cd ..
		graph export "$figures/figure4.pdf", replace

		
// Effect of tax day by age group

// TABLE A9
// support for redistribution by age group for results table in the appendix

cd "$tables"

eststo clear

reg gincdif i.treated##c.rv i.essround if abs(rv)<=10 & $drop3 & age15_24==1
estimates store m1
outreg2 using tableA9, replace tex dec(3) pdec(3) keep(1.treated rv 1.treated#c.rv)

reg gincdif i.treated##c.rv i.essround if abs(rv)<=10 & $drop3 & age25_34==1
estimates store m2
outreg2 using tableA9, append tex dec(3) pdec(3) keep(1.treated rv 1.treated#c.rv)

reg gincdif i.treated##c.rv i.essround if abs(rv)<=10 & $drop3 & age35_44==1
estimates store m3
outreg2 using tableA9, append tex dec(3) pdec(3) keep(1.treated rv 1.treated#c.rv)

reg gincdif i.treated##c.rv i.essround if abs(rv)<=10 & $drop3 & age45_54==1
estimates store m4
outreg2 using tableA9, append tex dec(3) pdec(3) keep(1.treated rv 1.treated#c.rv)

reg gincdif i.treated##c.rv i.essround if abs(rv)<=10 & $drop3 & age55_64==1
estimates store m5
outreg2 using tableA9, append tex dec(3) pdec(3) keep(1.treated rv 1.treated#c.rv)

reg gincdif i.treated##c.rv i.essround if abs(rv)<=10 & $drop3 & age65_74==1
estimates store m6
outreg2 using tableA9, append tex dec(3) pdec(3) keep(1.treated rv 1.treated#c.rv)

reg gincdif i.treated##c.rv i.essround if abs(rv)<=10 & $drop3 & age75_100==1
estimates store m7
outreg2 using tableA9, append tex dec(3) pdec(3) keep(1.treated rv 1.treated#c.rv)

// FIGURE 5

coefplot(m1, mcolor(black) ciopts(lcolor(black black))) ///
		(m2, mcolor(black) ciopts(lcolor(black black))) ///
		(m3, mcolor(black) ciopts(lcolor(black black))) ///
		(m4, mcolor(black) ciopts(lcolor(black black))) ///
		(m5, mcolor(black) ciopts(lcolor(black black))) ///
		(m6, mcolor(black) ciopts(lcolor(black black))) ///
		(m7, mcolor(black) ciopts(lcolor(black black))), ///
		vertical ///
		keep(1.treated) ///
		yline(0, lcolor(black) lwidth(thin) lpattern(dash)) ///
		graphregion(fcolor(white)) bgcolor(white) ///
		legend(off) ///
		ytitle("Effect on support for redistribution (1-5)", margin(r=2)) ///
		xtitle("Age groups (in years)", margin(t=2)) ///
		xlabel(0.635 "15-24" 0.75833 "25-34" 0.8816333 "35-44" 1.004999 "45-54" 1.128333 "55-64" 1.251666 "65-74" 1.375 "75-100", noticks labgap(*3))
		
		cd ..
		graph export "$figures/figure5.pdf", replace
	
	
// Effect of tax day by highest level of education

cd "$tables"

eststo clear

// recode other as missing
recode edulvla 55 = .

reg gincdif i.treated##c.rv i.essround if abs(rv)<=10 & $drop3 & edulvla==1
estimates store m1

reg gincdif i.treated##c.rv i.essround if abs(rv)<=10 & $drop3 & edulvla==2
estimates store m2

reg gincdif i.treated##c.rv i.essround if abs(rv)<=10 & $drop3 & edulvla==3
estimates store m3

reg gincdif i.treated##c.rv i.essround if abs(rv)<=10 & $drop3 & edulvla==4
estimates store m4

reg gincdif i.treated##c.rv i.essround if abs(rv)<=10 & $drop3 & edulvla==5
estimates store m5

// FIGURE A14

coefplot(m1, mcolor(black) ciopts(lcolor(black black))) ///
		(m2, mcolor(black) ciopts(lcolor(black black))) ///
		(m3, mcolor(black) ciopts(lcolor(black black))) ///
		(m4, mcolor(black) ciopts(lcolor(black black))) ///
		(m5, mcolor(black) ciopts(lcolor(black black))), ///
		vertical ///
		keep(1.treated) ///
		yline(0, lcolor(black) lwidth(thin) lpattern(dash)) ///
		graphregion(fcolor(white)) bgcolor(white) ///
		legend(off) ///
		ytitle("Effect on support for redistribution (1-5)", margin(r=2)) ///
		xtitle("Highest level of education", margin(t=2)) ///
		xlabel(0.67 `" "Less than" "lower sec." "' 0.835 "Lower sec." 1 "Upper sec." 1.165 `" "Post-sec." "non-tertiary" "' 1.33 "Tertiary", labsize(small) noticks labgap(*3))
		
		cd ..
		graph export "$figures/figureA14.pdf", replace

		
// Effect of tax day by level of political interest

cd "$tables"

eststo clear

reg gincdif i.treated##c.rv i.essround if abs(rv)<=10 & $drop3 & polintr ==1
estimates store m1

reg gincdif i.treated##c.rv i.essround if abs(rv)<=10 & $drop3 & polintr ==2
estimates store m2

reg gincdif i.treated##c.rv i.essround if abs(rv)<=10 & $drop3 & polintr ==3
estimates store m3

reg gincdif i.treated##c.rv i.essround if abs(rv)<=10 & $drop3 & polintr ==4
estimates store m4

// FIGURE A15

coefplot(m1, mcolor(black) ciopts(lcolor(black black))) ///
		(m2, mcolor(black) ciopts(lcolor(black black))) ///
		(m3, mcolor(black) ciopts(lcolor(black black))) ///
		(m4, mcolor(black) ciopts(lcolor(black black))), ///
		vertical ///
		keep(1.treated) ///
		yline(0, lcolor(black) lwidth(thin) lpattern(dash)) ///
		graphregion(fcolor(white)) bgcolor(white) ///
		legend(off) ///
		ytitle("Effect on support for redistribution (1-5)", margin(r=2)) ///
		xtitle("Interest in politics", margin(t=2)) ///
		xlabel(0.7 "Very interested" 0.9 "Quite interested" 1.1 "Hardly interested" 1.3 "Not at all", labsize(small) noticks labgap(*3))

		cd ..
		graph export "$figures/figureA15.pdf", replace

	
	
********************************************************************************
**							FIGURES A18 - A20								  **
**						ROBUSTNESS FOR TOP 10% RESULT						  **
**						 SUPPORT FOR REDISTRIBUTION							  **
********************************************************************************
		
// D10 ROBUSTNESS to weekday FEs

use "ess_finland.dta", clear
cd "$figures"

eststo clear

quietly reg gincdif i.treated##c.rv i.essround i.weekday if abs(rv)<=10 & $drop3 & hinctnta_combined==1
estimates store m1
quietly reg gincdif i.treated##c.rv i.essround i.weekday if abs(rv)<=10 & $drop3 & hinctnta_combined==2
estimates store m2
quietly reg gincdif i.treated##c.rv i.essround i.weekday if abs(rv)<=10 & $drop3 & hinctnta_combined==3
estimates store m3
quietly reg gincdif i.treated##c.rv i.essround i.weekday if abs(rv)<=10 & $drop3 & hinctnta_combined==4
estimates store m4
quietly reg gincdif i.treated##c.rv i.essround i.weekday if abs(rv)<=10 & $drop3 & hinctnta_combined==5
estimates store m5
quietly reg gincdif i.treated##c.rv i.essround i.weekday if abs(rv)<=10 & $drop3 & hinctnta_combined==6
estimates store m6
quietly reg gincdif i.treated##c.rv i.essround i.weekday if abs(rv)<=10 & $drop3 & hinctnta_combined==7
estimates store m7
quietly reg gincdif i.treated##c.rv i.essround i.weekday if abs(rv)<=10 & $drop3 & hinctnta_combined==8
estimates store m8
quietly reg gincdif i.treated##c.rv i.essround i.weekday if abs(rv)<=10 & $drop3 & hinctnta_combined==9
estimates store m9
quietly reg gincdif i.treated##c.rv i.essround i.weekday if abs(rv)<=10 & $drop3 & hinctnta_combined==10
estimates store m10

coefplot(m1, mcolor(black) ciopts(lcolor(black black))) ///
		(m2, mcolor(black) ciopts(lcolor(black black))) ///
		(m3, mcolor(black) ciopts(lcolor(black black))) ///
		(m4, mcolor(black) ciopts(lcolor(black black))) ///
		(m5, mcolor(black) ciopts(lcolor(black black))) ///
		(m6, mcolor(black) ciopts(lcolor(black black))) ///
		(m7, mcolor(black) ciopts(lcolor(black black))) ///
		(m8, mcolor(black) ciopts(lcolor(black black))) ///
		(m9, mcolor(black) ciopts(lcolor(black black))) ///
		(m10, mcolor(black) ciopts(lcolor(black black))), ///
		vertical ///
		keep(1.treated) ///
		yline(0, lcolor(black) lwidth(thin) lpattern(dash)) ///
		graphregion(fcolor(white)) bgcolor(white) ///
		legend(off) ///
		ytitle("Effect on support for redistribution (1-5)", margin(r=2)) ///
		xtitle("Income decile", margin(t=2)) ///
		xlabel(0.6 "1" 0.688 "2" 0.776 "3" 0.864 "4" 0.952 "5" 1.04 "6" 1.128 "7" 1.216 "8" 1.304 "9" 1.4 "10", noticks labgap(*3))

		cd ..
		graph export "$figures/figureA18.pdf", replace


// D10 ROBUSTNESS to alternative bandwidths 

use "ess_finland.dta", clear
cd "$bandwidth"
keep if hinctnta_combined==10

forvalues c = 5(1)30 {
	local k=`c'
	reg gincdif i.treated##c.rv i.essround if abs(rv)<=`c' & $drop3
	parmest, saving(bandwidth`c'.dta, replace)
	}

forvalues i = 5(1)30 {
	use bandwidth`i'.dta, clear
	gen bandwidth = `i'
	drop if parm!="1.treated"
	save, replace
	}

use bandwidth5.dta, clear
forvalues i = 6(1)30 {
	append using bandwidth`i'.dta
	}

twoway 	(rline min95 max95 bandwidth, ylabel(, format(%12.0g)) lpattern(dash) lcolor(gray) ///
		yline(0, lcolor(black) lwidth(vthin)) lwidth(med) ///
		yscale(range(-6(2)4)) ylab(-6(2)4) ///
		xaxis(1) xlabel(5(5)30, axis(1) format(%3.0f)) ///
		xline(10, lcolor(cranberry)) ///
		subtitle("Top income decile") legend(off) ///
		xtitle("Bandwidth (days)", axis(1)) ///
		ytitle("Effect on support for redistribution (1-5)") ///
		graphregion(color(white))) ///
		(scatter estimate bandwidth, connect(direct) lwidth(med) lcolor(black) msymbol(none))
		
		cd ..		
		graph export "$figures/figureA19.pdf", replace
				

// D10 ROBUSTNESS to alternative exclusion windows

use "ess_finland.dta", clear
cd "$figures"
	
keep if hinctnta_combined==10

eststo clear

quietly reg gincdif i.treated##c.rv i.essround if abs(rv)<=10
estimates store m0
quietly reg gincdif i.treated##c.rv i.essround if abs(rv)<=10 & $drop1
estimates store m1
quietly reg gincdif i.treated##c.rv i.essround if abs(rv)<=10 & $drop2
estimates store m2
quietly reg gincdif i.treated##c.rv i.essround if abs(rv)<=10 & $drop3
estimates store m3
quietly reg gincdif i.treated##c.rv i.essround if abs(rv)<=10 & $drop4
estimates store m4
quietly reg gincdif i.treated##c.rv i.essround if abs(rv)<=10 & $drop5
estimates store m5

coefplot(m0, mcolor(black) ciopts(lcolor(black))) ///
		(m1, mcolor(black) ciopts(lcolor(black))) ///
		(m2, mcolor(black) ciopts(lcolor(black))) ///
		(m3, mcolor(maroon) ciopts(lcolor(maroon)) msymbol(D)) ///
		(m4, mcolor(black) ciopts(lcolor(black))) ///
		(m5, mcolor(black) ciopts(lcolor(black))), ///
		vertical ///
		keep(1.treated) ///
		yline(0, lcolor(black) lwidth(thin) lpattern(dash)) ///
		graphregion(fcolor(white)) bgcolor(white) ///
		legend(off) ///
		title("Top income decile", c(black)) ///
		ytitle("Effect on support for redistribution (1-5)", margin(r=2)) ///
		xtitle("Days excluded prior to tax day", margin(t=2)) ///
		xlabel(0.64 "0" 0.784 "1" 0.928 "2" 1.072 "3" 1.216 "4" 1.36 "5", noticks labgap(*3))
		
		cd ..
		graph export "$figures/figureA20.pdf", replace			
				

// erase bandwidth data files
cd "$bandwidth"
local list : dir . files "*.dta"
foreach f of local list {
    erase "`f'"
}


********************************************************************************
**							FIGURES A21 - A25								  **
**					ROBUSTNESS FOR YOUNGEST AGE GROUP RESULT				  **
**						 SUPPORT FOR REDISTRIBUTION							  **
********************************************************************************
				
				
// Age 15-25 ROBUSTNESS to weekday FEs
cd ..
use "ess_finland.dta", clear
cd "$figures"

eststo clear

reg gincdif i.treated##c.rv i.essround i.weekday if abs(rv)<=10 & $drop3 & age15_24==1
estimates store m1
reg gincdif i.treated##c.rv i.essround i.weekday if abs(rv)<=10 & $drop3 & age25_34==1
estimates store m2
reg gincdif i.treated##c.rv i.essround i.weekday if abs(rv)<=10 & $drop3 & age35_44==1
estimates store m3
reg gincdif i.treated##c.rv i.essround i.weekday if abs(rv)<=10 & $drop3 & age45_54==1
estimates store m4
reg gincdif i.treated##c.rv i.essround i.weekday if abs(rv)<=10 & $drop3 & age55_64==1
estimates store m5
reg gincdif i.treated##c.rv i.essround i.weekday if abs(rv)<=10 & $drop3 & age65_74==1
estimates store m6
reg gincdif i.treated##c.rv i.essround i.weekday if abs(rv)<=10 & $drop3 & age75_100==1
estimates store m7

coefplot(m1, mcolor(black) ciopts(lcolor(black black))) ///
		(m2, mcolor(black) ciopts(lcolor(black black))) ///
		(m3, mcolor(black) ciopts(lcolor(black black))) ///
		(m4, mcolor(black) ciopts(lcolor(black black))) ///
		(m5, mcolor(black) ciopts(lcolor(black black))) ///
		(m6, mcolor(black) ciopts(lcolor(black black))) ///
		(m7, mcolor(black) ciopts(lcolor(black black))), ///
		vertical ///
		keep(1.treated) ///
		yline(0, lcolor(black) lwidth(thin) lpattern(dash)) ///
		graphregion(fcolor(white)) bgcolor(white) ///
		legend(off) ///
		ytitle("Effect on support for redistribution (1-5)", margin(r=2)) ///
		xtitle("Age groups (in years)", margin(t=2)) ///
		xlabel(0.635 "15-24" 0.75833 "25-34" 0.8816333 "35-44" 1.004999 "45-54" 1.128333 "55-64" 1.251666 "65-74" 1.375 "75-100", noticks labgap(*3))

		cd ..
		graph export "$figures/figureA21.pdf", replace

				

// Age 15-24 ROBUSTNESS to alternative bandwidths 

use "ess_finland.dta", clear
cd "$bandwidth"

keep if age15_24==1

forvalues c = 5(1)30 {
	local k=`c'
	reg gincdif i.treated##c.rv i.essround if abs(rv)<=`c' & $drop3
	parmest, saving(bandwidth`c'.dta, replace)
	}

forvalues i = 5(1)30 {
	use bandwidth`i'.dta, clear
	gen bandwidth = `i'
	drop if parm!="1.treated"
	save, replace
	}

use bandwidth5.dta, clear
forvalues i = 6(1)30 {
	append using bandwidth`i'.dta
	}

twoway 	(rline min95 max95 bandwidth, ylabel(, format(%12.0g)) lpattern(dash) lcolor(gray) ///
		yline(0, lcolor(black) lwidth(vthin)) lwidth(med) ///
		yscale(range(-1(1)5)) ylab(-1(1)5) ///
		xaxis(1) xlabel(5(5)30, axis(1) format(%3.0f)) ///
		xline(10, lcolor(cranberry)) ///
		subtitle("Age group 15-24") legend(off) ///
		xtitle("Bandwidth (days)", axis(1)) ///
		ytitle("Effect on support for redistribution (1-5)") ///
		graphregion(color(white))) ///
		(scatter estimate bandwidth, connect(direct) lwidth(med) lcolor(black) msymbol(none))
		
		cd ..
		graph export "$figures/figureA22.pdf", replace

// erase bandwidth data files
cd "$bandwidth"
local list : dir . files "*.dta"
foreach f of local list {
    erase "`f'"
}

// Age 15-24 ROBUSTNESS to alternative exclusion windows
cd ..
use "ess_finland.dta", clear
cd "$figures"
	
keep if age15_24==1

eststo clear

quietly reg gincdif i.treated##c.rv i.essround if abs(rv)<=10
estimates store m0
quietly reg gincdif i.treated##c.rv i.essround if abs(rv)<=10 & $drop1
estimates store m1
quietly reg gincdif i.treated##c.rv i.essround if abs(rv)<=10 & $drop2
estimates store m2
quietly reg gincdif i.treated##c.rv i.essround if abs(rv)<=10 & $drop3
estimates store m3
quietly reg gincdif i.treated##c.rv i.essround if abs(rv)<=10 & $drop4
estimates store m4
quietly reg gincdif i.treated##c.rv i.essround if abs(rv)<=10 & $drop5
estimates store m5

coefplot(m0, mcolor(black) ciopts(lcolor(black))) ///
		(m1, mcolor(black) ciopts(lcolor(black))) ///
		(m2, mcolor(black) ciopts(lcolor(black))) ///
		(m3, mcolor(maroon) ciopts(lcolor(maroon)) msymbol(D)) ///
		(m4, mcolor(black) ciopts(lcolor(black))) ///
		(m5, mcolor(black) ciopts(lcolor(black))), ///
		vertical ///
		keep(1.treated) ///
		yline(0, lcolor(black) lwidth(thin) lpattern(dash)) ///
		graphregion(fcolor(white)) bgcolor(white) ///
		legend(off) ///
		title("Age group 15-24", c(black)) ///
		ytitle("Effect on support for redistribution (1-5)", margin(r=2)) ///
		xtitle("Days excluded prior to tax day", margin(t=2)) ///
		xlabel(0.64 "0" 0.784 "1" 0.928 "2" 1.072 "3" 1.216 "4" 1.36 "5", noticks labgap(*3))
		
		cd ..
		graph export "$figures/figureA23.pdf", replace		

		
// ROBUSTNESS: Effect of tax day by age group controlling for income

use "ess_finland.dta", clear
cd "$tables"

eststo clear

reg gincdif i.treated##c.rv i.essround i.hinctnta_combined if abs(rv)<=10 & $drop3 & age15_24==1
estimates store m1

reg gincdif i.treated##c.rv i.essround i.hinctnta_combined if abs(rv)<=10 & $drop3 & age25_34==1
estimates store m2

reg gincdif i.treated##c.rv i.essround i.hinctnta_combined if abs(rv)<=10 & $drop3 & age35_44==1
estimates store m3

reg gincdif i.treated##c.rv i.essround i.hinctnta_combined if abs(rv)<=10 & $drop3 & age45_54==1
estimates store m4

reg gincdif i.treated##c.rv i.essround i.hinctnta_combined if abs(rv)<=10 & $drop3 & age55_64==1
estimates store m5

reg gincdif i.treated##c.rv i.essround i.hinctnta_combined if abs(rv)<=10 & $drop3 & age65_74==1
estimates store m6

reg gincdif i.treated##c.rv i.essround i.hinctnta_combined if abs(rv)<=10 & $drop3 & age75_100==1
estimates store m7

coefplot(m1, mcolor(black) ciopts(lcolor(black black))) ///
		(m2, mcolor(black) ciopts(lcolor(black black))) ///
		(m3, mcolor(black) ciopts(lcolor(black black))) ///
		(m4, mcolor(black) ciopts(lcolor(black black))) ///
		(m5, mcolor(black) ciopts(lcolor(black black))) ///
		(m6, mcolor(black) ciopts(lcolor(black black))) ///
		(m7, mcolor(black) ciopts(lcolor(black black))), ///
		vertical ///
		keep(1.treated) ///
		yline(0, lcolor(black) lwidth(thin) lpattern(dash)) ///
		graphregion(fcolor(white)) bgcolor(white) ///
		legend(off) ///
		ytitle("Effect on support for redistribution (1-5)", margin(r=2)) ///
		xtitle("Age groups (in years)", margin(t=2)) ///
		xlabel(0.635 "15-24" 0.75833 "25-34" 0.8816333 "35-44" 1.004999 "45-54" 1.128333 "55-64" 1.251666 "65-74" 1.375 "75-100", noticks labgap(*3))
		
		cd ..
		graph export "$figures/figureA24.pdf", replace

		
// ROBUSTNESS: using 4-year bins rather than 9-year bins

use "ess_finland.dta", clear
cd "$figures"

eststo clear

reg gincdif i.treated##c.rv i.essround if abs(rv)<=10 & $drop3 & age15_19==1
estimates store m1
reg gincdif i.treated##c.rv i.essround if abs(rv)<=10 & $drop3 & age20_24==1
estimates store m2
reg gincdif i.treated##c.rv i.essround if abs(rv)<=10 & $drop3 & age25_29==1
estimates store m3
reg gincdif i.treated##c.rv i.essround if abs(rv)<=10 & $drop3 & age30_34==1
estimates store m4
reg gincdif i.treated##c.rv i.essround if abs(rv)<=10 & $drop3 & age35_39==1
estimates store m5
reg gincdif i.treated##c.rv i.essround if abs(rv)<=10 & $drop3 & age40_44==1
estimates store m6
reg gincdif i.treated##c.rv i.essround if abs(rv)<=10 & $drop3 & age45_49==1
estimates store m7
reg gincdif i.treated##c.rv i.essround if abs(rv)<=10 & $drop3 & age50_54==1
estimates store m8
reg gincdif i.treated##c.rv i.essround if abs(rv)<=10 & $drop3 & age55_59==1
estimates store m9
reg gincdif i.treated##c.rv i.essround if abs(rv)<=10 & $drop3 & age60_64==1
estimates store m10
reg gincdif i.treated##c.rv i.essround if abs(rv)<=10 & $drop3 & age65_69==1
estimates store m11

coefplot(m1, mcolor(black) ciopts(lcolor(black black))) ///
		(m2, mcolor(black) ciopts(lcolor(black black))) ///
		(m3, mcolor(black) ciopts(lcolor(black black))) ///
		(m4, mcolor(black) ciopts(lcolor(black black))) ///
		(m5, mcolor(black) ciopts(lcolor(black black))) ///
		(m6, mcolor(black) ciopts(lcolor(black black))) ///
		(m7, mcolor(black) ciopts(lcolor(black black))) ///
		(m8, mcolor(black) ciopts(lcolor(black black))) ///
		(m9, mcolor(black) ciopts(lcolor(black black))) ///
		(m10, mcolor(black) ciopts(lcolor(black black))) ///
		(m11, mcolor(black) ciopts(lcolor(black black))), ///
		vertical ///
		keep(1.treated) ///
		yline(0, lcolor(black) lwidth(thin) lpattern(dash)) ///
		graphregion(fcolor(white)) bgcolor(white) ///
		legend(off) ///
		ytitle("Effect on support for redistribution (1-5)", margin(r=2)) ///
		xtitle("Age groups (in years)", margin(t=2)) ///
		xlabel(0.58 "15-19" 0.664 "20-24" 0.748 "25-29" 0.832 "30-34" 0.916 "35-39" 1 "40-44" 1.084 "45-49" 1.168 "50-54" 1.252 "55-59" 1.336 "60-64" 1.42 "65-69", noticks labgap(*3))
		
		cd ..
		graph export "$figures/figureA25.pdf", replace

		
********************************************************************************
**						MECHANISMS: OVERALL NULL EFFECT						  **
********************************************************************************

use "ess_finland.dta", clear

// Weak treatment - is the tax day comparable to Perez-Truglia's (2020, AER)
// income transparency intervention in Norway?
********************************************************************************

// FIGURE A1

// Effect on (probit-adjusted and standardised) life satisfaction by deciles

eststo clear

reg stpols_stflife i.treated##c.rv i.essround if abs(rv)<=10 & $drop3 & hinctnta_combined==1
estimates store m1
quietly reg stpols_stflife i.treated##c.rv i.essround if abs(rv)<=10 & $drop3 & hinctnta_combined==2
estimates store m2
quietly reg stpols_stflife i.treated##c.rv i.essround if abs(rv)<=10 & $drop3 & hinctnta_combined==3
estimates store m3
quietly reg stpols_stflife i.treated##c.rv i.essround if abs(rv)<=10 & $drop3 & hinctnta_combined==4
estimates store m4
quietly reg stpols_stflife i.treated##c.rv i.essround if abs(rv)<=10 & $drop3 & hinctnta_combined==5
estimates store m5
quietly reg stpols_stflife i.treated##c.rv i.essround if abs(rv)<=10 & $drop3 & hinctnta_combined==6
estimates store m6
quietly reg stpols_stflife i.treated##c.rv i.essround if abs(rv)<=10 & $drop3 & hinctnta_combined==7
estimates store m7
quietly reg stpols_stflife i.treated##c.rv i.essround if abs(rv)<=10 & $drop3 & hinctnta_combined==8
estimates store m8
quietly reg stpols_stflife i.treated##c.rv i.essround if abs(rv)<=10 & $drop3 & hinctnta_combined==9
estimates store m9
reg stpols_stflife i.treated##c.rv i.essround if abs(rv)<=10 & $drop3 & hinctnta_combined==10
estimates store m10

coefplot(m1, mcolor(black) ciopts(lcolor(black black))) ///
		(m2, mcolor(black) ciopts(lcolor(black black))) ///
		(m3, mcolor(black) ciopts(lcolor(black black))) ///
		(m4, mcolor(black) ciopts(lcolor(black black))) ///
		(m5, mcolor(black) ciopts(lcolor(black black))) ///
		(m6, mcolor(black) ciopts(lcolor(black black))) ///
		(m7, mcolor(black) ciopts(lcolor(black black))) ///
		(m8, mcolor(black) ciopts(lcolor(black black))) ///
		(m9, mcolor(black) ciopts(lcolor(black black))) ///
		(m10, mcolor(black) ciopts(lcolor(black black))), ///
		vertical ///
		keep(1.treated) ///
		yline(0, lcolor(black) lwidth(thin) lpattern(dash)) ///
		graphregion(fcolor(white)) bgcolor(white) ///
		legend(off) ///
		ytitle("Effect on life satisfaction (standardised)", margin(r=2)) ///
		xtitle("Income decile", margin(t=2)) ///
		xlabel(0.6 "1" 0.688 "2" 0.776 "3" 0.864 "4" 0.952 "5" 1.04 "6" 1.128 "7" 1.216 "8" 1.304 "9" 1.4 "10", noticks labgap(*3))

		graph export "$figures/figureA1.pdf", replace


// FIGURE A27
// Effect on income adequacy by deciles

use "ess_finland.dta", clear

eststo clear

reg adequate i.treated##c.rv i.essround if abs(rv)<=10 & $drop3 & hinctnta_combined==1
estimates store m1
quietly reg adequate i.treated##c.rv i.essround if abs(rv)<=10 & $drop3 & hinctnta_combined==2
estimates store m2
quietly reg adequate i.treated##c.rv i.essround if abs(rv)<=10 & $drop3 & hinctnta_combined==3
estimates store m3
quietly reg adequate i.treated##c.rv i.essround if abs(rv)<=10 & $drop3 & hinctnta_combined==4
estimates store m4
quietly reg adequate i.treated##c.rv i.essround if abs(rv)<=10 & $drop3 & hinctnta_combined==5
estimates store m5
quietly reg adequate i.treated##c.rv i.essround if abs(rv)<=10 & $drop3 & hinctnta_combined==6
estimates store m6
quietly reg adequate i.treated##c.rv i.essround if abs(rv)<=10 & $drop3 & hinctnta_combined==7
estimates store m7
quietly reg adequate i.treated##c.rv i.essround if abs(rv)<=10 & $drop3 & hinctnta_combined==8
estimates store m8
quietly reg adequate i.treated##c.rv i.essround if abs(rv)<=10 & $drop3 & hinctnta_combined==9
estimates store m9
reg adequate i.treated##c.rv i.essround if abs(rv)<=10 & $drop3 & hinctnta_combined==10
estimates store m10

coefplot(m1, mcolor(black) ciopts(lcolor(black black))) ///
		(m2, mcolor(black) ciopts(lcolor(black black))) ///
		(m3, mcolor(black) ciopts(lcolor(black black))) ///
		(m4, mcolor(black) ciopts(lcolor(black black))) ///
		(m5, mcolor(black) ciopts(lcolor(black black))) ///
		(m6, mcolor(black) ciopts(lcolor(black black))) ///
		(m7, mcolor(black) ciopts(lcolor(black black))) ///
		(m8, mcolor(black) ciopts(lcolor(black black))) ///
		(m9, mcolor(black) ciopts(lcolor(black black))) ///
		(m10, mcolor(black) ciopts(lcolor(black black))), ///
		vertical ///
		keep(1.treated) ///
		yline(0, lcolor(black) lwidth(thin) lpattern(dash)) ///
		graphregion(fcolor(white)) bgcolor(white) ///
		legend(off) ///
		ytitle("Effect on income adequacy (1-4)", margin(r=2)) ///
		xtitle("Income decile", margin(t=2)) ///
		xlabel(0.6 "1" 0.688 "2" 0.776 "3" 0.864 "4" 0.952 "5" 1.04 "6" 1.128 "7" 1.216 "8" 1.304 "9" 1.4 "10", noticks labgap(*3))
		
		graph export "$figures/figureA27.pdf", replace
		
		
// Information saturation - are there effects in early ESS rounds?
********************************************************************************

// Below-median income

use "ess_finland.dta", clear

keep if bmedian == 1

eststo clear

quietly reg gincdif i.treated##c.rv if abs(rv)<=10 & $drop3 & essround==1
estimates store m0
quietly reg gincdif i.treated##c.rv if abs(rv)<=10 & $drop3 & essround==2
estimates store m1
quietly reg gincdif i.treated##c.rv if abs(rv)<=10 & $drop3 & essround==3
estimates store m2
quietly reg gincdif i.treated##c.rv if abs(rv)<=10 & $drop3 & essround==4
estimates store m3
quietly reg gincdif i.treated##c.rv if abs(rv)<=10 & $drop3 & essround==5
estimates store m4
quietly reg gincdif i.treated##c.rv if abs(rv)<=10 & $drop3 & essround==6
estimates store m5
quietly reg gincdif i.treated##c.rv if abs(rv)<=10 & $drop3 & essround==7
estimates store m6
quietly reg gincdif i.treated##c.rv if abs(rv)<=10 & $drop3 & essround==8
estimates store m7
quietly reg gincdif i.treated##c.rv if abs(rv)<=10 & $drop3 & essround==9
estimates store m8

coefplot(m0, mcolor(black) ciopts(lcolor(black black))) ///
		(m1, mcolor(black) ciopts(lcolor(black black))) ///
		(m2, mcolor(black) ciopts(lcolor(black black))) ///
		(m3, mcolor(black) ciopts(lcolor(black black))) ///
		(m4, mcolor(black) ciopts(lcolor(black black))) ///
		(m5, mcolor(black) ciopts(lcolor(black black))) ///
		(m6, mcolor(black) ciopts(lcolor(black black))) ///
		(m7, mcolor(black) ciopts(lcolor(black black))) ///
		(m8, mcolor(black) ciopts(lcolor(black black))), ///
		vertical ///
		keep(1.treated) ///
		yline(0, lcolor(black) lwidth(thin) lpattern(dash)) ///
		levels(99 95) ciopts(lwidth(*1 *5)) ///
		graphregion(fcolor(white)) bgcolor(white) ///
		legend(off) ///
		title("Below-median income", c(black)) ///
		ytitle("Effect on support for redistribution (1-5)", margin(r=2)) ///
		xtitle("Survey year", margin(t=2)) ///
		xlabel(0.6 "2002" 0.7 "2004" 0.8 "2006" 0.9 "2008" 1 "2010" 1.1 "2012" 1.2 "2014" 1.3 "2016" 1.4 "2018", noticks labgap(*3))
		
		graph save "$figures/byround_poor.gph", replace


// Above-median income

use "ess_finland.dta", clear
	
keep if bmedian == 0

eststo clear

quietly reg gincdif i.treated##c.rv if abs(rv)<=10 & $drop3 & essround==1
estimates store m0
quietly reg gincdif i.treated##c.rv if abs(rv)<=10 & $drop3 & essround==2
estimates store m1
quietly reg gincdif i.treated##c.rv if abs(rv)<=10 & $drop3 & essround==3
estimates store m2
quietly reg gincdif i.treated##c.rv if abs(rv)<=10 & $drop3 & essround==4
estimates store m3
quietly reg gincdif i.treated##c.rv if abs(rv)<=10 & $drop3 & essround==5
estimates store m4
quietly reg gincdif i.treated##c.rv if abs(rv)<=10 & $drop3 & essround==6
estimates store m5
quietly reg gincdif i.treated##c.rv if abs(rv)<=10 & $drop3 & essround==7
estimates store m6
quietly reg gincdif i.treated##c.rv if abs(rv)<=10 & $drop3 & essround==8
estimates store m7
quietly reg gincdif i.treated##c.rv if abs(rv)<=10 & $drop3 & essround==9
estimates store m8

coefplot(m0, mcolor(black) ciopts(lcolor(black black))) ///
		(m1, mcolor(black) ciopts(lcolor(black black))) ///
		(m2, mcolor(black) ciopts(lcolor(black black))) ///
		(m3, mcolor(black) ciopts(lcolor(black black))) ///
		(m4, mcolor(black) ciopts(lcolor(black black))) ///
		(m5, mcolor(black) ciopts(lcolor(black black))) ///
		(m6, mcolor(black) ciopts(lcolor(black black))) ///
		(m7, mcolor(black) ciopts(lcolor(black black))) ///
		(m8, mcolor(black) ciopts(lcolor(black black))), ///
		vertical ///
		keep(1.treated) ///
		yline(0, lcolor(black) lwidth(thin) lpattern(dash)) ///
		levels(99 95) ciopts(lwidth(*1 *5)) ///
		graphregion(fcolor(white)) bgcolor(white) ///
		legend(off) ///
		title("Above-median income", c(black)) ///
		ytitle("Effect on support for redistribution (1-5)", margin(r=2)) ///
		xtitle("Survey year", margin(t=2)) ///
		xlabel(0.6 "2002" 0.7 "2004" 0.8 "2006" 0.9 "2008" 1 "2010" 1.1 "2012" 1.2 "2014" 1.3 "2016" 1.4 "2018", noticks labgap(*3))

		graph save "$figures/byround_rich.gph", replace

// Combine graphs
cd "$figures"
graph	combine byround_poor.gph byround_rich.gph, ///
		graphregion(margin(zero) color(white)) ysize(7) row(2)
		
		graph export "figureA26.pdf", replace
		erase "byround_poor.gph"
		erase "byround_rich.gph"
		cd ..
		
		

// Table A11
// Ceiling effects - results tables for alternative measures of support for redistribution
******************************************************************************************

// Below-median

use "ess_finland.dta", clear
cd "$tables"

keep if bmedian == 1

reg gvslvue i.treated##c.rv i.essround if abs(rv)<=10 & $drop3
outreg2 using tableA11a, replace tex dec(3) ctitle(Unempl) pdec(3) keep(1.treated rv 1.treated#c.rv)

foreach y of varlist gvcldcr sofrdst sofrpr {

reg `y' i.treated##c.rv i.essround if abs(rv)<=10 & $drop3
outreg2 using tableA11a, append tex dec(3) ctitle(`y') pdec(3) keep(1.treated rv 1.treated#c.rv)

}

// Above-median

cd ..
use "ess_finland.dta", clear
cd "$tables"
	
keep if bmedian == 0

reg gvslvue i.treated##c.rv i.essround if abs(rv)<=10 & $drop3
outreg2 using tableA11b, replace tex dec(3) ctitle(Unempl) pdec(3) keep(1.treated rv 1.treated#c.rv)

foreach y of varlist gvcldcr sofrdst sofrpr {

reg `y' i.treated##c.rv i.essround if abs(rv)<=10 & $drop3
outreg2 using tableA11b, append tex dec(3) ctitle(`y') pdec(3) keep(1.treated rv 1.treated#c.rv)

}

cd ..

// FIGURE A16
// Partisanship - are there effects for those with weak party attachment?
********************************************************************************

// Partisan respondents

use "ess_finland.dta", clear
cd "$bandwidth"

keep if partisan == 1

forvalues c = 5(1)30 {
	local k=`c'
	reg gincdif i.treated##c.rv i.essround i.hinctnta_combined if abs(rv)<=`c' & $drop3
	parmest, saving(bandwidth`c'.dta, replace)
	}

forvalues i = 5(1)30 {
	use bandwidth`i'.dta, clear
	gen bandwidth = `i'
	drop if parm!="1.treated"
	save, replace
	}

use bandwidth5.dta, clear
forvalues i = 6(1)30 {
	append using bandwidth`i'.dta
	}

twoway 	(rline min95 max95 bandwidth, ylabel(, format(%12.0g)) lpattern(dash) lcolor(gray) ///
		yline(0, lcolor(black) lwidth(vthin)) lwidth(med) ///
		xaxis(1) xlabel(5(5)30, axis(1) format(%3.0f)) ///
		xline(10, lcolor(cranberry)) ///
		subtitle("Partisans") legend(off) ///
		xtitle("Bandwidth (days)", axis(1)) ///
		ytitle("Effect on support for redistribution (1-5)") ///
		graphregion(color(white))) ///
		(scatter estimate bandwidth, connect(direct) lwidth(med) lcolor(black) msymbol(none))
		
		cd ..
		graph save "$figures/gincdif_partisan.gph", replace

// Non-partisan respondents

use "ess_finland.dta", clear
cd "$bandwidth"

keep if partisan == 0

forvalues c = 5(1)30 {
	local k=`c'
	reg gincdif i.treated##c.rv i.essround i.hinctnta_combined if abs(rv)<=`c' & $drop3
	parmest, saving(bandwidth`c'.dta, replace)
	}

forvalues i = 5(1)30 {
	use bandwidth`i'.dta, clear
	gen bandwidth = `i'
	drop if parm!="1.treated"
	save, replace
	}

use bandwidth5.dta, clear
forvalues i = 6(1)30 {
	append using bandwidth`i'.dta
	}

twoway 	(rline min95 max95 bandwidth, ylabel(, format(%12.0g)) lpattern(dash) lcolor(gray) ///
		yline(0, lcolor(black) lwidth(vthin)) lwidth(med) ///
		xaxis(1) xlabel(5(5)30, axis(1) format(%3.0f)) ///
		xline(10, lcolor(cranberry)) ///
		subtitle("Non-partisans") legend(off) ///
		xtitle("Bandwidth (days)", axis(1)) ///
		ytitle("Effect on support for redistribution (1-5)") ///
		graphregion(color(white))) ///
		(scatter estimate bandwidth, connect(direct) lwidth(med) lcolor(black) msymbol(none))
		
		cd ..
		graph save "$figures/gincdif_nonpartisan.gph", replace

	// Combine graphs
		cd "$figures"
		gr combine gincdif_partisan.gph gincdif_nonpartisan.gph, row(2) graphregion(margin(zero) color(white)) ysize(6.5)
		graph export "figureA16.pdf", replace
		erase "gincdif_partisan.gph"
		erase "gincdif_nonpartisan.gph"
		cd ..

// erase bandwidth data files
cd "$bandwidth"
local list : dir . files "*.dta"
foreach f of local list {
    erase "`f'"
}

		
// FIGURE A17
// Political ideology - are there divergent effects for left- and right-wing respondents?
********************************************************************************

// Left-wing respondents
cd ..
use "ess_finland.dta", clear
cd "$bandwidth"

pwcorr lrscale gincdif, sig

keep if left == 1

forvalues c = 5(1)30 {
	local k=`c'
	reg gincdif i.treated##c.rv i.essround i.hinctnta_combined if abs(rv)<=`c' & $drop3
	parmest, saving(bandwidth`c'.dta, replace)
	}

forvalues i = 5(1)30 {
	use bandwidth`i'.dta, clear
	gen bandwidth = `i'
	drop if parm!="1.treated"
	save, replace
	}

use bandwidth5.dta, clear
forvalues i = 6(1)30 {
	append using bandwidth`i'.dta
	}

twoway 	(rline min95 max95 bandwidth, ylabel(, format(%12.0g)) lpattern(dash) lcolor(gray) ///
		yline(0, lcolor(black) lwidth(vthin)) lwidth(med) ///
		xaxis(1) xlabel(5(5)30, axis(1) format(%3.0f)) ///
		xline(10, lcolor(cranberry)) ///
		subtitle("Left-wing") legend(off) ///
		xtitle("Bandwidth (days)", axis(1)) ///
		ytitle("Effect on support for redistribution (1-5)") ///
		graphregion(color(white))) ///
		(scatter estimate bandwidth, connect(direct) lwidth(med) lcolor(black) msymbol(none))
		
		cd ..
		graph save "$figures/gincdif_left.gph", replace

// Right-wing respondents

use "ess_finland.dta", clear
cd "$bandwidth"

keep if right == 1

forvalues c = 5(1)30 {
	local k=`c'
	reg gincdif i.treated##c.rv i.essround i.hinctnta_combined if abs(rv)<=`c' & $drop3
	parmest, saving(bandwidth`c'.dta, replace)
	}

forvalues i = 5(1)30 {
	use bandwidth`i'.dta, clear
	gen bandwidth = `i'
	drop if parm!="1.treated"
	save, replace
	}

use bandwidth5.dta, clear
forvalues i = 6(1)30 {
	append using bandwidth`i'.dta
	}

twoway 	(rline min95 max95 bandwidth, ylabel(, format(%12.0g)) lpattern(dash) lcolor(gray) ///
		yline(0, lcolor(black) lwidth(vthin)) lwidth(med) ///
		xaxis(1) xlabel(5(5)30, axis(1) format(%3.0f)) ///
		xline(10, lcolor(cranberry)) ///
		subtitle("Right-wing") legend(off) ///
		xtitle("Bandwidth (days)", axis(1)) ///
		ytitle("Effect on support for redistribution (1-5)") ///
		graphregion(color(white))) ///
		(scatter estimate bandwidth, connect(direct) lwidth(med) lcolor(black) msymbol(none))
		
		cd ..
		graph save "$figures/gincdif_right.gph", replace

		// Combine graphs
		cd "$figures"
		gr combine gincdif_left.gph gincdif_right.gph, row(2) graphregion(margin(zero) color(white)) ysize(6.5)
		graph export "figureA17.pdf", replace
		erase "gincdif_left.gph"
		erase "gincdif_right.gph"
		cd ..	

// erase bandwidth data files
cd "$bandwidth"
local list : dir . files "*.dta"
foreach f of local list {
    erase "`f'"
}
		
		
********************************************************************************
**							MECHANISMS: TOP 10% EFFECT						  **
********************************************************************************

// FIGURE A28
// Salience of tax burden: effect on support for higher taxes for high earners
cd ..
use "ess_finland.dta", clear
cd "$figures"

eststo clear

reg tax i.treated##c.rv i.essround c.agea i.male c.eduyrs i.pdwrk i.unemployment i.edctn i.rtrd i.hswrk if abs(rv)<=10 & $drop3 & hinctnta_combined==1
estimates store m1
quietly reg tax i.treated##c.rv i.essround c.agea i.male c.eduyrs i.pdwrk i.unemployment i.edctn i.rtrd i.hswrk if abs(rv)<=10 & $drop3 & hinctnta_combined==2
estimates store m2
quietly reg tax i.treated##c.rv i.essround c.agea i.male c.eduyrs i.pdwrk i.unemployment i.edctn i.rtrd i.hswrk if abs(rv)<=10 & $drop3 & hinctnta_combined==3
estimates store m3
quietly reg tax i.treated##c.rv i.essround c.agea i.male c.eduyrs i.pdwrk i.unemployment i.edctn i.rtrd i.hswrk if abs(rv)<=10 & $drop3 & hinctnta_combined==4
estimates store m4
quietly reg tax i.treated##c.rv i.essround c.agea i.male c.eduyrs i.pdwrk i.unemployment i.edctn i.rtrd i.hswrk if abs(rv)<=10 & $drop3 & hinctnta_combined==5
estimates store m5
quietly reg tax i.treated##c.rv i.essround c.agea i.male c.eduyrs i.pdwrk i.unemployment i.edctn i.rtrd i.hswrk if abs(rv)<=10 & $drop3 & hinctnta_combined==6
estimates store m6
quietly reg tax i.treated##c.rv i.essround c.agea i.male c.eduyrs i.pdwrk i.unemployment i.edctn i.rtrd i.hswrk if abs(rv)<=10 & $drop3 & hinctnta_combined==7
estimates store m7
quietly reg tax i.treated##c.rv i.essround c.agea i.male c.eduyrs i.pdwrk i.unemployment i.edctn i.rtrd i.hswrk if abs(rv)<=10 & $drop3 & hinctnta_combined==8
estimates store m8
quietly reg tax i.treated##c.rv i.essround c.agea i.male c.eduyrs i.pdwrk i.unemployment i.edctn i.rtrd i.hswrk if abs(rv)<=10 & $drop3 & hinctnta_combined==9
estimates store m9
reg tax i.treated##c.rv i.essround c.agea i.male c.eduyrs i.pdwrk i.unemployment i.edctn i.rtrd i.hswrk if abs(rv)<=10 & $drop3 & hinctnta_combined==10
estimates store m10

coefplot(m1, mcolor(black) ciopts(lcolor(black black))) ///
		(m2, mcolor(black) ciopts(lcolor(black black))) ///
		(m3, mcolor(black) ciopts(lcolor(black black))) ///
		(m4, mcolor(black) ciopts(lcolor(black black))) ///
		(m5, mcolor(black) ciopts(lcolor(black black))) ///
		(m6, mcolor(black) ciopts(lcolor(black black))) ///
		(m7, mcolor(black) ciopts(lcolor(black black))) ///
		(m8, mcolor(black) ciopts(lcolor(black black))) ///
		(m9, mcolor(black) ciopts(lcolor(black black))) ///
		(m10, mcolor(black) ciopts(lcolor(black black))), ///
		vertical ///
		keep(1.treated) ///
		yline(0, lcolor(black) lwidth(thin) lpattern(dash)) ///
		graphregion(fcolor(white)) bgcolor(white) ///
		legend(off) ///
		ytitle("Effect on support for taxing top-earners more", margin(r=2)) ///
		xtitle("Income decile", margin(t=2)) ///
		xlabel(0.6 "1" 0.688 "2" 0.776 "3" 0.864 "4" 0.952 "5" 1.04 "6" 1.128 "7" 1.216 "8" 1.304 "9" 1.4 "10", noticks labgap(*3))
		
		graph export figureA28.pdf, replace


// FIGURE A29
// Status concerns: effect on agreement with statement that important to be rich, have money and expensive things

cd ..
use "ess_finland.dta", clear
cd "$figures"

eststo clear

reg imprich i.treated##c.rv i.essround c.agea i.male c.eduyrs i.pdwrk i.unemployment i.edctn i.rtrd i.hswrk if abs(rv)<=10 & $drop3 & hinctnta_combined==1
estimates store m1
quietly reg imprich i.treated##c.rv i.essround c.agea i.male c.eduyrs i.pdwrk i.unemployment i.edctn i.rtrd i.hswrk if abs(rv)<=10 & $drop3 & hinctnta_combined==2
estimates store m2
quietly reg imprich i.treated##c.rv i.essround c.agea i.male c.eduyrs i.pdwrk i.unemployment i.edctn i.rtrd i.hswrk if abs(rv)<=10 & $drop3 & hinctnta_combined==3
estimates store m3
quietly reg imprich i.treated##c.rv i.essround c.agea i.male c.eduyrs i.pdwrk i.unemployment i.edctn i.rtrd i.hswrk if abs(rv)<=10 & $drop3 & hinctnta_combined==4
estimates store m4
quietly reg imprich i.treated##c.rv i.essround c.agea i.male c.eduyrs i.pdwrk i.unemployment i.edctn i.rtrd i.hswrk if abs(rv)<=10 & $drop3 & hinctnta_combined==5
estimates store m5
quietly reg imprich i.treated##c.rv i.essround c.agea i.male c.eduyrs i.pdwrk i.unemployment i.edctn i.rtrd i.hswrk if abs(rv)<=10 & $drop3 & hinctnta_combined==6
estimates store m6
quietly reg imprich i.treated##c.rv i.essround c.agea i.male c.eduyrs i.pdwrk i.unemployment i.edctn i.rtrd i.hswrk if abs(rv)<=10 & $drop3 & hinctnta_combined==7
estimates store m7
quietly reg imprich i.treated##c.rv i.essround c.agea i.male c.eduyrs i.pdwrk i.unemployment i.edctn i.rtrd i.hswrk if abs(rv)<=10 & $drop3 & hinctnta_combined==8
estimates store m8
quietly reg imprich i.treated##c.rv i.essround c.agea i.male c.eduyrs i.pdwrk i.unemployment i.edctn i.rtrd i.hswrk if abs(rv)<=10 & $drop3 & hinctnta_combined==9
estimates store m9
reg imprich i.treated##c.rv i.essround c.agea i.male c.eduyrs i.pdwrk i.unemployment i.edctn i.rtrd i.hswrk if abs(rv)<=10 & $drop3 & hinctnta_combined==10
estimates store m10

coefplot(m1, mcolor(black) ciopts(lcolor(black black))) ///
		(m2, mcolor(black) ciopts(lcolor(black black))) ///
		(m3, mcolor(black) ciopts(lcolor(black black))) ///
		(m4, mcolor(black) ciopts(lcolor(black black))) ///
		(m5, mcolor(black) ciopts(lcolor(black black))) ///
		(m6, mcolor(black) ciopts(lcolor(black black))) ///
		(m7, mcolor(black) ciopts(lcolor(black black))) ///
		(m8, mcolor(black) ciopts(lcolor(black black))) ///
		(m9, mcolor(black) ciopts(lcolor(black black))) ///
		(m10, mcolor(black) ciopts(lcolor(black black))), ///
		vertical ///
		keep(1.treated) ///
		yline(0, lcolor(black) lwidth(thin) lpattern(dash)) ///
		graphregion(fcolor(white)) bgcolor(white) ///
		legend(off) ///
		ytitle("Effect on perceived importance of being rich", margin(r=2)) ///
		xtitle("Income decile", margin(t=2)) ///
		xlabel(0.6 "1" 0.688 "2" 0.776 "3" 0.864 "4" 0.952 "5" 1.04 "6" 1.128 "7" 1.216 "8" 1.304 "9" 1.4 "10", noticks labgap(*3))
		
		graph export figureA29.pdf, replace


// FIGURE A3
// Motivated reasoning: effect on agreement with statement that “for a fair society, differences in standard of living should be small.”

cd ..
use "ess_finland.dta", clear
cd "$figures"

eststo clear

reg smdfslv i.treated##c.rv i.essround c.agea i.male c.eduyrs i.pdwrk i.unemployment i.edctn i.rtrd i.hswrk if abs(rv)<=10 & $drop3 & hinctnta_combined==1
estimates store m1
quietly reg smdfslv i.treated##c.rv i.essround c.agea i.male c.eduyrs i.pdwrk i.unemployment i.edctn i.rtrd i.hswrk if abs(rv)<=10 & $drop3 & hinctnta_combined==2
estimates store m2
quietly reg smdfslv i.treated##c.rv i.essround c.agea i.male c.eduyrs i.pdwrk i.unemployment i.edctn i.rtrd i.hswrk if abs(rv)<=10 & $drop3 & hinctnta_combined==3
estimates store m3
quietly reg smdfslv i.treated##c.rv i.essround c.agea i.male c.eduyrs i.pdwrk i.unemployment i.edctn i.rtrd i.hswrk if abs(rv)<=10 & $drop3 & hinctnta_combined==4
estimates store m4
quietly reg smdfslv i.treated##c.rv i.essround c.agea i.male c.eduyrs i.pdwrk i.unemployment i.edctn i.rtrd i.hswrk if abs(rv)<=10 & $drop3 & hinctnta_combined==5
estimates store m5
quietly reg smdfslv i.treated##c.rv i.essround c.agea i.male c.eduyrs i.pdwrk i.unemployment i.edctn i.rtrd i.hswrk if abs(rv)<=10 & $drop3 & hinctnta_combined==6
estimates store m6
quietly reg smdfslv i.treated##c.rv i.essround c.agea i.male c.eduyrs i.pdwrk i.unemployment i.edctn i.rtrd i.hswrk if abs(rv)<=10 & $drop3 & hinctnta_combined==7
estimates store m7
quietly reg smdfslv i.treated##c.rv i.essround c.agea i.male c.eduyrs i.pdwrk i.unemployment i.edctn i.rtrd i.hswrk if abs(rv)<=10 & $drop3 & hinctnta_combined==8
estimates store m8
quietly reg smdfslv i.treated##c.rv i.essround c.agea i.male c.eduyrs i.pdwrk i.unemployment i.edctn i.rtrd i.hswrk if abs(rv)<=10 & $drop3 & hinctnta_combined==9
estimates store m9
reg smdfslv i.treated##c.rv i.essround c.agea i.male c.eduyrs i.pdwrk i.unemployment i.edctn i.rtrd i.hswrk if abs(rv)<=10 & $drop3 & hinctnta_combined==10
estimates store m10

coefplot(m1, mcolor(black) ciopts(lcolor(black black))) ///
		(m2, mcolor(black) ciopts(lcolor(black black))) ///
		(m3, mcolor(black) ciopts(lcolor(black black))) ///
		(m4, mcolor(black) ciopts(lcolor(black black))) ///
		(m5, mcolor(black) ciopts(lcolor(black black))) ///
		(m6, mcolor(black) ciopts(lcolor(black black))) ///
		(m7, mcolor(black) ciopts(lcolor(black black))) ///
		(m8, mcolor(black) ciopts(lcolor(black black))) ///
		(m9, mcolor(black) ciopts(lcolor(black black))) ///
		(m10, mcolor(black) ciopts(lcolor(black black))), ///
		vertical ///
		keep(1.treated) ///
		yline(0, lcolor(black) lwidth(thin) lpattern(dash)) ///
		graphregion(fcolor(white)) bgcolor(white) ///
		legend(off) ///
		ytitle("Effect on belief that inequality is unfair", margin(r=2)) ///
		xtitle("Income decile", margin(t=2)) ///
		xlabel(0.6 "1" 0.688 "2" 0.776 "3" 0.864 "4" 0.952 "5" 1.04 "6" 1.128 "7" 1.216 "8" 1.304 "9" 1.4 "10", noticks labgap(*3))
		
		graph export figureA3.pdf, replace


// FIGURE A30
// Motivated reasoning (ROBUSTNESS): effect on disagreement with statement that “large differences in income are acceptable to reward talents and efforts”
// Higher values reflect more left-wing attitudes

cd ..
use "ess_finland.dta", clear
cd "$figures"

eststo clear

reg dfincac i.treated##c.rv i.essround c.agea i.male c.eduyrs i.pdwrk i.unemployment i.edctn i.rtrd i.hswrk if abs(rv)<=10 & $drop3 & hinctnta_combined==1
estimates store m1
quietly reg dfincac i.treated##c.rv i.essround c.agea i.male c.eduyrs i.pdwrk i.unemployment i.edctn i.rtrd i.hswrk if abs(rv)<=10 & $drop3 & hinctnta_combined==2
estimates store m2
quietly reg dfincac i.treated##c.rv i.essround c.agea i.male c.eduyrs i.pdwrk i.unemployment i.edctn i.rtrd i.hswrk if abs(rv)<=10 & $drop3 & hinctnta_combined==3
estimates store m3
quietly reg dfincac i.treated##c.rv i.essround c.agea i.male c.eduyrs i.pdwrk i.unemployment i.edctn i.rtrd i.hswrk if abs(rv)<=10 & $drop3 & hinctnta_combined==4
estimates store m4
quietly reg dfincac i.treated##c.rv i.essround c.agea i.male c.eduyrs i.pdwrk i.unemployment i.edctn i.rtrd i.hswrk if abs(rv)<=10 & $drop3 & hinctnta_combined==5
estimates store m5
quietly reg dfincac i.treated##c.rv i.essround c.agea i.male c.eduyrs i.pdwrk i.unemployment i.edctn i.rtrd i.hswrk if abs(rv)<=10 & $drop3 & hinctnta_combined==6
estimates store m6
quietly reg dfincac i.treated##c.rv i.essround c.agea i.male c.eduyrs i.pdwrk i.unemployment i.edctn i.rtrd i.hswrk if abs(rv)<=10 & $drop3 & hinctnta_combined==7
estimates store m7
quietly reg dfincac i.treated##c.rv i.essround c.agea i.male c.eduyrs i.pdwrk i.unemployment i.edctn i.rtrd i.hswrk if abs(rv)<=10 & $drop3 & hinctnta_combined==8
estimates store m8
quietly reg dfincac i.treated##c.rv i.essround c.agea i.male c.eduyrs i.pdwrk i.unemployment i.edctn i.rtrd i.hswrk if abs(rv)<=10 & $drop3 & hinctnta_combined==9
estimates store m9
reg dfincac i.treated##c.rv i.essround c.agea i.male c.eduyrs i.pdwrk i.unemployment i.edctn i.rtrd i.hswrk if abs(rv)<=10 & $drop3 & hinctnta_combined==10
estimates store m10

coefplot(m1, mcolor(black) ciopts(lcolor(black black))) ///
		(m2, mcolor(black) ciopts(lcolor(black black))) ///
		(m3, mcolor(black) ciopts(lcolor(black black))) ///
		(m4, mcolor(black) ciopts(lcolor(black black))) ///
		(m5, mcolor(black) ciopts(lcolor(black black))) ///
		(m6, mcolor(black) ciopts(lcolor(black black))) ///
		(m7, mcolor(black) ciopts(lcolor(black black))) ///
		(m8, mcolor(black) ciopts(lcolor(black black))) ///
		(m9, mcolor(black) ciopts(lcolor(black black))) ///
		(m10, mcolor(black) ciopts(lcolor(black black))), ///
		vertical ///
		keep(1.treated) ///
		yline(0, lcolor(black) lwidth(thin) lpattern(dash)) ///
		graphregion(fcolor(white)) bgcolor(white) ///
		legend(off) ///
		ytitle("Effect on belief that inequality is unjustified", margin(r=2)) ///
		xtitle("Income decile", margin(t=2)) ///
		xlabel(0.6 "1" 0.688 "2" 0.776 "3" 0.864 "4" 0.952 "5" 1.04 "6" 1.128 "7" 1.216 "8" 1.304 "9" 1.4 "10", noticks labgap(*3))
		
		graph export figureA30.pdf, replace



********************************************************************************
**							MECHANISMS: AGE 15-24 EFFECT					  **
********************************************************************************

cd ..
use "ess_finland.dta", clear
cd "$figures"

** descriptives for the income adequacy measure
tabstat adequate, s(mean sd min max n)

** Association between age group and income adequacy is positive and signifcant
pwcorr agegroup adequate, sig


// FIGURE A5
// Effect of tax day on perceived income adequacy by age group

eststo clear

reg adequate i.treated##c.rv i.essround if abs(rv)<=10 & $drop3 & age15_24==1
estimates store m1
reg adequate i.treated##c.rv i.essround if abs(rv)<=10 & $drop3 & age25_34==1
estimates store m2
reg adequate i.treated##c.rv i.essround if abs(rv)<=10 & $drop3 & age35_44==1
estimates store m3
reg adequate i.treated##c.rv i.essround if abs(rv)<=10 & $drop3 & age45_54==1
estimates store m4
reg adequate i.treated##c.rv i.essround if abs(rv)<=10 & $drop3 & age55_64==1
estimates store m5
reg adequate i.treated##c.rv i.essround if abs(rv)<=10 & $drop3 & age65_74==1
estimates store m6
reg adequate i.treated##c.rv i.essround if abs(rv)<=10 & $drop3 & age75_100==1
estimates store m7

coefplot(m1, mcolor(black) ciopts(lcolor(black black))) ///
		(m2, mcolor(black) ciopts(lcolor(black black))) ///
		(m3, mcolor(black) ciopts(lcolor(black black))) ///
		(m4, mcolor(black) ciopts(lcolor(black black))) ///
		(m5, mcolor(black) ciopts(lcolor(black black))) ///
		(m6, mcolor(black) ciopts(lcolor(black black))) ///
		(m7, mcolor(black) ciopts(lcolor(black black))), ///
		vertical ///
		keep(1.treated) ///
		yline(0, lcolor(black) lwidth(thin) lpattern(dash)) ///
		graphregion(fcolor(white)) bgcolor(white) ///
		legend(off) ///
		ytitle("Effect on income adequacy (1-4)", margin(r=2)) ///
		xtitle("Age groups (in years)", margin(t=2)) ///
		xlabel(0.635 "15-24" 0.75833 "25-34" 0.8816333 "35-44" 1.004999 "45-54" 1.128333 "55-64" 1.251666 "65-74" 1.375 "75-100", noticks labgap(*3))
		
		graph export "figureA5.pdf", replace
	
		
// Mechanism: media exposure

// Mean media exposure by age group
tabstat nwspol_bi, s(mean median sd min max) by(agegroup)
reg nwspol_bi i.agegroup
* 30% high media exposure 15-24 yrs vs 73% high exposure 75-100 yrs


// Low exposure

cd ..
use "ess_finland.dta", clear
cd "$bandwidth"

keep if nwspol_bi == 0

forvalues c = 5(1)30 {
	local k=`c'
	reg gincdif i.treated##c.rv i.essround if abs(rv)<=`c' & $drop3
	parmest, saving(bandwidth`c'.dta, replace)
	}

forvalues i = 5(1)30 {
	use bandwidth`i'.dta, clear
	gen bandwidth = `i'
	drop if parm!="1.treated"
	save, replace
	}

use bandwidth5.dta, clear
forvalues i = 6(1)30 {
	append using bandwidth`i'.dta
	}

twoway 	(rline min95 max95 bandwidth, ylabel(, format(%12.0g)) lpattern(dash) lcolor(gray) ///
		yline(0, lcolor(black) lwidth(vthin)) lwidth(med) ///
		xaxis(1) xlabel(5(5)30, axis(1) format(%3.0f)) ///
		xline(10, lcolor(cranberry)) ///
		subtitle("Low media exposure") legend(off) ///
		xtitle("Bandwidth (days)", axis(1)) ///
		ytitle("Effect on support for redistribution (1-5)") ///
		graphregion(color(white))) ///
		(scatter estimate bandwidth, connect(direct) lwidth(med) lcolor(black) msymbol(none))
		
		cd ..
		graph save "$figures/gincdif_nwspol_low.gph", replace


// High exposure

use "ess_finland.dta", clear
cd "$bandwidth"

keep if nwspol_bi == 1

forvalues c = 5(1)30 {
	local k=`c'
	reg gincdif i.treated##c.rv i.essround if abs(rv)<=`c' & $drop3
	parmest, saving(bandwidth`c'.dta, replace)
	}

forvalues i = 5(1)30 {
	use bandwidth`i'.dta, clear
	gen bandwidth = `i'
	drop if parm!="1.treated"
	save, replace
	}

use bandwidth5.dta, clear
forvalues i = 6(1)30 {
	append using bandwidth`i'.dta
	}

twoway 	(rline min95 max95 bandwidth, ylabel(, format(%12.0g)) lpattern(dash) lcolor(gray) ///
		yline(0, lcolor(black) lwidth(vthin)) lwidth(med) ///
		xaxis(1) xlabel(5(5)30, axis(1) format(%3.0f)) ///
		xline(10, lcolor(cranberry)) ///
		subtitle("High media exposure") legend(off) ///
		xtitle("Bandwidth (days)", axis(1)) ///
		ytitle("Effect on support for redistribution (1-5)") ///
		graphregion(color(white))) ///
		(scatter estimate bandwidth, connect(direct) lwidth(med) lcolor(black) msymbol(none))
		
		cd ..
		graph save "$figures/gincdif_nwspol_high.gph", replace


// FIGURE A31
// Combine graphs
cd "$figures"
gr combine gincdif_nwspol_low.gph gincdif_nwspol_high.gph, row(2) graphregion(margin(zero) color(white)) ysize(6.5)

graph export "figureA31.pdf", replace

erase "gincdif_nwspol_low.gph"
erase "gincdif_nwspol_high.gph"
cd ..

// erase bandwidth data files
cd "$bandwidth"
local list : dir . files "*.dta"
foreach f of local list {
    erase "`f'"
}


// FIGURE A4
// Effect of tax day by age group and level of political interest (triple-interaction suggested by R3)
cd ..
use "ess_finland.dta", clear
cd "$tables"

eststo clear

// Interested in politics
keep if interest==1

reg gincdif i.treated##c.rv i.essround if abs(rv)<=10 & $drop3 & age15_24==1
estimates store m1

reg gincdif i.treated##c.rv i.essround if abs(rv)<=10 & $drop3 & age25_34==1
estimates store m2

reg gincdif i.treated##c.rv i.essround if abs(rv)<=10 & $drop3 & age35_44==1
estimates store m3

reg gincdif i.treated##c.rv i.essround if abs(rv)<=10 & $drop3 & age45_54==1
estimates store m4

reg gincdif i.treated##c.rv i.essround if abs(rv)<=10 & $drop3 & age55_64==1
estimates store m5

reg gincdif i.treated##c.rv i.essround if abs(rv)<=10 & $drop3 & age65_74==1
estimates store m6

reg gincdif i.treated##c.rv i.essround if abs(rv)<=10 & $drop3 & age75_100==1
estimates store m7

coefplot(m1, mcolor(black) ciopts(lcolor(black black))) ///
		(m2, mcolor(black) ciopts(lcolor(black black))) ///
		(m3, mcolor(black) ciopts(lcolor(black black))) ///
		(m4, mcolor(black) ciopts(lcolor(black black))) ///
		(m5, mcolor(black) ciopts(lcolor(black black))) ///
		(m6, mcolor(black) ciopts(lcolor(black black))) ///
		(m7, mcolor(black) ciopts(lcolor(black black))), ///
		vertical ///
		keep(1.treated) ///
		yline(0, lcolor(black) lwidth(thin) lpattern(dash)) ///
		graphregion(fcolor(white)) bgcolor(white) ///
		legend(off) ///
		title("Interested in politics") ///
		ytitle("Effect on support for redistribution (1-5)", margin(r=2)) ///
		xtitle("Age groups (in years)", margin(t=2)) ///
		xlabel(0.635 "15-24" 0.75833 "25-34" 0.8816333 "35-44" 1.004999 "45-54" 1.128333 "55-64" 1.251666 "65-74" 1.375 "75-100", noticks labgap(*3))
		
		cd ..
		graph save "$figures/gincdif_agegroups_polint1.gph", replace



use "ess_finland.dta", clear
cd "$tables"

eststo clear

// NOT interested in politics
keep if interest==0

reg gincdif i.treated##c.rv i.essround if abs(rv)<=10 & $drop3 & age15_24==1
estimates store m1

reg gincdif i.treated##c.rv i.essround if abs(rv)<=10 & $drop3 & age25_34==1
estimates store m2

reg gincdif i.treated##c.rv i.essround if abs(rv)<=10 & $drop3 & age35_44==1
estimates store m3

reg gincdif i.treated##c.rv i.essround if abs(rv)<=10 & $drop3 & age45_54==1
estimates store m4

reg gincdif i.treated##c.rv i.essround if abs(rv)<=10 & $drop3 & age55_64==1
estimates store m5

reg gincdif i.treated##c.rv i.essround if abs(rv)<=10 & $drop3 & age65_74==1
estimates store m6

reg gincdif i.treated##c.rv i.essround if abs(rv)<=10 & $drop3 & age75_100==1
estimates store m7

coefplot(m1, mcolor(black) ciopts(lcolor(black black))) ///
		(m2, mcolor(black) ciopts(lcolor(black black))) ///
		(m3, mcolor(black) ciopts(lcolor(black black))) ///
		(m4, mcolor(black) ciopts(lcolor(black black))) ///
		(m5, mcolor(black) ciopts(lcolor(black black))) ///
		(m6, mcolor(black) ciopts(lcolor(black black))) ///
		(m7, mcolor(black) ciopts(lcolor(black black))), ///
		vertical ///
		keep(1.treated) ///
		yline(0, lcolor(black) lwidth(thin) lpattern(dash)) ///
		graphregion(fcolor(white)) bgcolor(white) ///
		legend(off) ///
		title("Not interested in politics") ///
		ytitle("Effect on support for redistribution (1-5)", margin(r=2)) ///
		xtitle("Age groups (in years)", margin(t=2)) ///
		xlabel(0.635 "15-24" 0.75833 "25-34" 0.8816333 "35-44" 1.004999 "45-54" 1.128333 "55-64" 1.251666 "65-74" 1.375 "75-100", noticks labgap(*3))
		
		cd ..
		graph save "$figures/gincdif_agegroups_polint2.gph", replace

// Combine graphs
cd "$figures"
gr combine gincdif_agegroups_polint1.gph gincdif_agegroups_polint2.gph, row(2) graphregion(margin(zero) color(white)) ysize(6.5)

graph export "figureA4.pdf", replace

erase "gincdif_agegroups_polint1.gph"
erase "gincdif_agegroups_polint2.gph"


********************************************************************************
**							FIGURE A8: COVARIATE BALANCE					  **
********************************************************************************

// This section is adapted from the replication file of Munoz et al., 2020, PA

// Open dataset
cd ..
use "ess_finland.dta", clear
cd "$figures"

* Some data management is needed before generating Figure with t-tests for the different control/treatment group comparisons

* 20-day window
gen treatment_twenty = . 
replace treatment_twenty = 0 if rv >= -21 & rv < 0
replace treatment_twenty = 1 if rv >= 0 & rv <= 20 
tab intdate treatment_twenty, m

* 15-day window
gen treatment_fifteen = . 
replace treatment_fifteen = 0 if rv >= -16 & rv < 0
replace treatment_fifteen = 1 if rv >= 0 & rv <= 15 
tab intdate treatment_fifteen, m

* 10-day window
gen treatment_ten = . 
replace treatment_ten = 0 if rv >= -11 & rv < 0
replace treatment_ten = 1 if rv >= 0 & rv <= 10 
tab intdate treatment_ten, m

* 5-day window
gen treatment_five = . 
replace treatment_five = 0 if rv >= -6 & rv < 0
replace treatment_five = 1 if rv >= 0 & rv <= 5 
tab intdate treatment_five, m

* Labelling treatment variables 
label def tr 0"Control" 1"Treatment"
label val treatment_* tr

* Reversing treatment variables so that in means comparisons higher numbers means higher (proportion) in treatment group
foreach var of varlist treatment_*{
	gen r_`var' = `var'
	recode r_`var' (1=0) (0=1)
}

* Rescaling some variables for the display of T-tests
gen age_r = agea/10
label var age_r "Age (Years/10)"

gen education_r = eduyrs / 10 
label var education_r "Education (Years/10)"

* Voted last national election: 1 = Those who voted last national elections / 0 = Respondents who did not vote or who were not elegible to vote 
gen vote_r = vote 
recode vote_r (3=0) (2=0)
lab var vote_r "Voted in last election" 

* Attempts to survey
gen attempts_r = attempts_to_survey / 10
label var attempts_r "Attempts to survey (N/10)"


* Conducting t-test and storing results in matrix to generate the plot (it is necessary to estimate the confidence intervals "manually") 
foreach tr of varlist r_treatment_*{
	matrix mean = J(1,11,.)
	matrix colnames mean = age_r education_r citizenship male pdwrk unemployment edctn ///
	rtrd hswrk vote_r attempts_r
	matrix CI = J(4,11,.)
	matrix colnames CI = age_r education_r citizenship male pdwrk unemployment edctn ///
	rtrd hswrk vote_r attempts_r
	matrix rownames CI = ll95 ul95 ll90 ul90
	local i 0
	foreach var of varlist age_r education_r citizenship male pdwrk unemployment edctn ///
		rtrd hswrk vote_r attempts_r{
		quietly: ttest `var', by(`tr') 
		local ++ i 
		local diff = r(mu_1) - r(mu_2) 
		matrix mean[1, `i'] = `diff' 
		local degrees = r(df_t)
		local critical_5 = invttail(`degrees', 0.025)
		local confvalue_5 = `critical_5' * r(se)
		local critical_10 = invttail(`degrees', 0.05)
		local confvalue_10 = `critical_10' * r(se)
		local ll95 = `diff' - `confvalue_5'
		local ul95 = `diff' + `confvalue_5'
		local ll90 = `diff' - `confvalue_10'
		local ul90 = `diff' + `confvalue_10'
		matrix CI[1, `i'] = `ll95' \ `ul95' \ `ll90' \ `ul90'
	}
matrix `tr'_m = mean
matrix `tr'_CI = CI
}


* Generating Figure from results stored in matrices 

coefplot	(matrix(r_treatment_twenty_m), xline(0)	///
			ci((r_treatment_twenty_CI[1] r_treatment_twenty_CI[2]) (r_treatment_twenty_CI[3] r_treatment_twenty_CI[4]))) ///
			|| (matrix(r_treatment_fifteen_m), xline(0, lpattern(solid))	///
			ci((r_treatment_fifteen_CI[1] r_treatment_fifteen_CI[2]) (r_treatment_fifteen_CI[3] r_treatment_fifteen_CI[4]))) ///
			|| (matrix(r_treatment_ten_m), xline(0, lpattern(solid))	///
			ci((r_treatment_ten_CI[1] r_treatment_ten_CI[2]) (r_treatment_ten_CI[3] r_treatment_ten_CI[4]))) ///
			|| (matrix(r_treatment_five_m), xline(0, lpattern(solid)) ///
			ci((r_treatment_five_CI[1] r_treatment_five_CI[2]) (r_treatment_five_CI[3] r_treatment_five_CI[4])) ///
			pstyle(p1) if(@ll>-.3&@ul<.3)) ///
			(matrix(r_treatment_five_m), xline(0, lpattern(solid)) ///
			ci((r_treatment_five_CI[1] r_treatment_five_CI[2]) (r_treatment_five_CI[3] r_treatment_five_CI[4])) ///
			pstyle(p1) if(@ll<-.3&@ul>.3) ciopts(recast(pcbarrow))) ///
			,  ///
			byopts(row(2)) xlabel(-.3(.1).3) xscale(range(-.3 .3)) ///
			transform(* = min(max(@,-.3),.3)) nooffset nokey bylabels("{&plusminus} 20 days" "{&plusminus} 15 days" "{&plusminus} 10 days" "{&plusminus} 5 days")

gr_edit .style.editstyle boxstyle(shadestyle(color(white))) editcopy
gr_edit .style.editstyle boxstyle(linestyle(color(white))) editcopy
	

graph export figureA8.pdf, replace 
cd ..


********************************************************************************
**					 	APPENDIX: MAIN RESULTS TABLES						  **
**					 			TABLES A3 & A5						 		  **
********************************************************************************

// BELOW-MEDIAN

use "ess_finland.dta", clear
cd "$tables"

keep if bmedian == 1

reg topinfr_new i.treated##c.rv i.essround if abs(rv)<=10 & $drop3
outreg2 using tableA3a, replace tex dec(3) ctitle(unfair) pdec(3) keep(1.treated rv 1.treated#c.rv)

foreach y of varlist gincdif {

reg `y' i.treated##c.rv i.essround if abs(rv)<=10 & $drop3
outreg2 using tableA3a, append tex dec(3) ctitle(`y') pdec(3) keep(1.treated rv 1.treated#c.rv)

}

// ABOVE-MEDIAN

cd ..
use "ess_finland.dta", clear
cd "$tables"
	
keep if bmedian == 0

reg topinfr_new i.treated##c.rv i.essround if abs(rv)<=10 & $drop3
outreg2 using tableA3b, replace tex dec(3) ctitle(unfair) pdec(3) keep(1.treated rv 1.treated#c.rv)

foreach y of varlist gincdif {

reg `y' i.treated##c.rv i.essround if abs(rv)<=10 & $drop3
outreg2 using tableA3b, append tex dec(3) ctitle(`y') pdec(3) keep(1.treated rv 1.treated#c.rv)

}

// WHOLE SAMPLE

cd ..
use "ess_finland.dta", clear
cd "$tables"

reg topinfr_new i.treated##c.rv i.essround if abs(rv)<=10 & $drop3
outreg2 using tableA5, replace tex dec(3) ctitle(unfair) pdec(3) keep(1.treated rv 1.treated#c.rv)

foreach y of varlist gincdif {

reg `y' i.treated##c.rv i.essround if abs(rv)<=10 & $drop3
outreg2 using tableA5, append tex dec(3) ctitle(`y') pdec(3) keep(1.treated rv 1.treated#c.rv)

}
		
********************************************************************************
**					 	APPENDIX: MAIN RESULTS TABLES						  **
**						 (using cluster-robust SEs)					  		  **
**					 			TABLES A4 & A6						 		  **
********************************************************************************

// BELOW-MEDIAN

cd ..
use "ess_finland.dta", clear
cd "$tables"

keep if bmedian == 1

reg topinfr_new i.treated##c.rv i.essround if abs(rv)<=10 & $drop3, vce(cluster rv)
outreg2 using tableA4a, replace tex dec(3) ctitle(unfair) pdec(3) keep(1.treated rv 1.treated#c.rv)

foreach y of varlist gincdif {

reg `y' i.treated##c.rv i.essround if abs(rv)<=10 & $drop3, vce(cluster rv)
outreg2 using tableA4a, append tex dec(3) ctitle(`y') pdec(3) keep(1.treated rv 1.treated#c.rv)

}

// ABOVE-MEDIAN

cd ..
use "ess_finland.dta", clear
cd "$tables"
	
keep if bmedian == 0

reg topinfr_new i.treated##c.rv i.essround if abs(rv)<=10 & $drop3, vce(cluster rv)
outreg2 using tableA4b, replace tex dec(3) ctitle(unfair) pdec(3) keep(1.treated rv 1.treated#c.rv)

foreach y of varlist gincdif {

reg `y' i.treated##c.rv i.essround if abs(rv)<=10 & $drop3, vce(cluster rv)
outreg2 using tableA4b, append tex dec(3) ctitle(`y') pdec(3) keep(1.treated rv 1.treated#c.rv)

}

// WHOLE SAMPLE

cd ..
use "ess_finland.dta", clear
cd "$tables"

reg topinfr_new i.treated##c.rv i.essround if abs(rv)<=10 & $drop3, vce(cluster rv)
outreg2 using tableA6, replace tex dec(3) ctitle(unfair) pdec(3) keep(1.treated rv 1.treated#c.rv)

foreach y of varlist gincdif {

reg `y' i.treated##c.rv i.essround if abs(rv)<=10 & $drop3, vce(cluster rv)
outreg2 using tableA6, append tex dec(3) ctitle(`y') pdec(3) keep(1.treated rv 1.treated#c.rv)

}
		



********************************************************************************
**					APPENDIX: SUPPORT FOR REDISTRIBUTION					  **
** 						(using cluster-robust SEs)							  **
********************************************************************************				
				
// TABLE A8: Effect of tax day by income decile
				
cd ..
use "ess_finland.dta", clear
cd "$tables"

eststo clear

quietly reg gincdif i.treated##c.rv i.essround if abs(rv)<=10 & $drop3 & hinctnta_combined==1, vce(cluster rv)
estimates store m1
outreg2 using tableA8, replace tex dec(3) pdec(3) keep(1.treated rv 1.treated#c.rv)

quietly reg gincdif i.treated##c.rv i.essround if abs(rv)<=10 & $drop3 & hinctnta_combined==2, vce(cluster rv)
estimates store m2
outreg2 using tableA8, append tex dec(3) pdec(3) keep(1.treated rv 1.treated#c.rv)

quietly reg gincdif i.treated##c.rv i.essround if abs(rv)<=10 & $drop3 & hinctnta_combined==3, vce(cluster rv)
estimates store m3
outreg2 using tableA8, append tex dec(3) pdec(3) keep(1.treated rv 1.treated#c.rv)

quietly reg gincdif i.treated##c.rv i.essround if abs(rv)<=10 & $drop3 & hinctnta_combined==4, vce(cluster rv)
estimates store m4
outreg2 using tableA8, append tex dec(3) pdec(3) keep(1.treated rv 1.treated#c.rv)

quietly reg gincdif i.treated##c.rv i.essround if abs(rv)<=10 & $drop3 & hinctnta_combined==5, vce(cluster rv)
estimates store m5
outreg2 using tableA8, append tex dec(3) pdec(3) keep(1.treated rv 1.treated#c.rv)

quietly reg gincdif i.treated##c.rv i.essround if abs(rv)<=10 & $drop3 & hinctnta_combined==6, vce(cluster rv)
estimates store m6
outreg2 using tableA8, append tex dec(3) pdec(3) keep(1.treated rv 1.treated#c.rv)

quietly reg gincdif i.treated##c.rv i.essround if abs(rv)<=10 & $drop3 & hinctnta_combined==7, vce(cluster rv)
estimates store m7
outreg2 using tableA8, append tex dec(3) pdec(3) keep(1.treated rv 1.treated#c.rv)

quietly reg gincdif i.treated##c.rv i.essround if abs(rv)<=10 & $drop3 & hinctnta_combined==8, vce(cluster rv)
estimates store m8
outreg2 using tableA8, append tex dec(3) pdec(3) keep(1.treated rv 1.treated#c.rv)

quietly reg gincdif i.treated##c.rv i.essround if abs(rv)<=10 & $drop3 & hinctnta_combined==9, vce(cluster rv)
estimates store m9
outreg2 using tableA8, append tex dec(3) pdec(3) keep(1.treated rv 1.treated#c.rv)

reg gincdif i.treated##c.rv i.essround if abs(rv)<=10 & $drop3 & hinctnta_combined==10, vce(cluster rv)
estimates store m10
outreg2 using tableA8, append tex dec(3) pdec(3) keep(1.treated rv 1.treated#c.rv)
		

// TABLE A10: Effect of tax day by age group

cd ..
use "ess_finland.dta", clear
cd "$tables"

eststo clear

reg gincdif i.treated##c.rv i.essround if abs(rv)<=10 & $drop3 & age15_24==1, vce(cluster rv)
estimates store m1
outreg2 using tableA10, replace tex dec(3) pdec(3) keep(1.treated rv 1.treated#c.rv)

reg gincdif i.treated##c.rv i.essround if abs(rv)<=10 & $drop3 & age25_34==1, vce(cluster rv)
estimates store m2
outreg2 using tableA10, append tex dec(3) pdec(3) keep(1.treated rv 1.treated#c.rv)

reg gincdif i.treated##c.rv i.essround if abs(rv)<=10 & $drop3 & age35_44==1, vce(cluster rv)
estimates store m3
outreg2 using tableA10, append tex dec(3) pdec(3) keep(1.treated rv 1.treated#c.rv)

reg gincdif i.treated##c.rv i.essround if abs(rv)<=10 & $drop3 & age45_54==1, vce(cluster rv)
estimates store m4
outreg2 using tableA10, append tex dec(3) pdec(3) keep(1.treated rv 1.treated#c.rv)

reg gincdif i.treated##c.rv i.essround if abs(rv)<=10 & $drop3 & age55_64==1, vce(cluster rv)
estimates store m5
outreg2 using tableA10, append tex dec(3) pdec(3) keep(1.treated rv 1.treated#c.rv)

reg gincdif i.treated##c.rv i.essround if abs(rv)<=10 & $drop3 & age65_74==1, vce(cluster rv)
estimates store m6
outreg2 using tableA10, append tex dec(3) pdec(3) keep(1.treated rv 1.treated#c.rv)

reg gincdif i.treated##c.rv i.essround if abs(rv)<=10 & $drop3 & age75_100==1, vce(cluster rv)
estimates store m7
outreg2 using tableA10, append tex dec(3) pdec(3) keep(1.treated rv 1.treated#c.rv)



********************************************************************************
**						APPENDIX: ALTERNATIVE MEASURES						  **
**						OF SUPPORT FOR REDISTRIBUTION						  **
********************************************************************************

// Open dataset
cd ..
use "ess_finland.dta", clear

// Table A2: Summary stats for alternative DVs
lab var gvslvue "Support for unemployment benefits"
lab var gvcldcr "Support for public childcare"
lab var sofrdst "Preference for economic equality"
lab var sofrpr "Support for social safety net"
eststo clear
xi: estpost summarize gvslvue gvcldcr sofrdst sofrpr
esttab using "$tables/tableA2.tex", replace ///
    cells("count(fmt(a2)) mean sd min max") label ///
	nomtitle nonumber noobs
eststo clear

// Density plots of alternative measures
hist gvslvue, 	col(gs8) fc(gs12) freq graphregion(color(white)) ///
				xtitle("Support for unemployment benefits", margin(small) size(*1.15)) ///
				ytitle("Number of respondents", margin(small) size(*1.15)) ///
				yscale(range(0(500)1500)) ylab(0(500)1500) ///
				legend(off)
				graph save "$figures/hist_gvslvue.gph", replace

hist gvcldcr, 	col(gs8) fc(gs12) freq graphregion(color(white)) ///
				xtitle("Support for public childcare", margin(small) size(*1.15)) ///
				ytitle("", margin(small) size(*1.15)) ///
				yscale(range(0(500)1500)) ylab(0(500)1500) ///
				legend(off)
				graph save "$figures/hist_gvcldcr.gph", replace

hist sofrdst, 	col(gs8) fc(gs12) freq graphregion(color(white)) ///
				xtitle("Preference for economic equality", margin(small) size(*1.15)) ///
				ytitle("Number of respondents", margin(small) size(*1.15)) ///
				yscale(range(0(300)1000)) ylab(0(300)1000) ///
				legend(off)
				graph save "$figures/hist_sofrdst.gph", replace
	
hist sofrpr, 	col(gs8) fc(gs12) freq graphregion(color(white)) ///
				xtitle("Support for social safety net", margin(small) size(*1.15)) ///
				ytitle("", margin(small) size(*1.15)) ///
				yscale(range(0(300)1000)) ylab(0(300)1000) ///
				legend(off)
				graph save "$figures/hist_sofrpr.gph", replace			

// Combine density plots for alternative measures

clear
cd "$figures"
graph combine	hist_gvslvue.gph hist_gvcldcr.gph hist_sofrdst.gph hist_sofrpr.gph, ///
				graphregion(margin(zero) color(white))
				graph export "figureA13.pdf", replace
				
				erase "hist_gvslvue.gph"
				erase "hist_gvcldcr.gph"
				erase "hist_sofrdst.gph"
				erase "hist_sofrpr.gph"
				

********************************************************************************
**						APPENDIX: PLACEBO OUTCOME	 						  **
********************************************************************************				
				
// Effect of tax day on attitudes towards gays and lesbians by income decile
				
cd ..
use "ess_finland.dta", clear
cd "$figures"

eststo clear

reg gay i.treated##c.rv i.essround if abs(rv)<=10 & $drop3 & hinctnta_combined==1
estimates store m1
quietly reg gay i.treated##c.rv i.essround if abs(rv)<=10 & $drop3 & hinctnta_combined==2
estimates store m2
quietly reg gay i.treated##c.rv i.essround if abs(rv)<=10 & $drop3 & hinctnta_combined==3
estimates store m3
quietly reg gay i.treated##c.rv i.essround if abs(rv)<=10 & $drop3 & hinctnta_combined==4
estimates store m4
quietly reg gay i.treated##c.rv i.essround if abs(rv)<=10 & $drop3 & hinctnta_combined==5
estimates store m5
quietly reg gay i.treated##c.rv i.essround if abs(rv)<=10 & $drop3 & hinctnta_combined==6
estimates store m6
quietly reg gay i.treated##c.rv i.essround if abs(rv)<=10 & $drop3 & hinctnta_combined==7
estimates store m7
quietly reg gay i.treated##c.rv i.essround if abs(rv)<=10 & $drop3 & hinctnta_combined==8
estimates store m8
quietly reg gay i.treated##c.rv i.essround if abs(rv)<=10 & $drop3 & hinctnta_combined==9
estimates store m9
reg gay i.treated##c.rv i.essround if abs(rv)<=10 & $drop3 & hinctnta_combined==10
estimates store m10

coefplot(m1, mcolor(black) ciopts(lcolor(black black))) ///
		(m2, mcolor(black) ciopts(lcolor(black black))) ///
		(m3, mcolor(black) ciopts(lcolor(black black))) ///
		(m4, mcolor(black) ciopts(lcolor(black black))) ///
		(m5, mcolor(black) ciopts(lcolor(black black))) ///
		(m6, mcolor(black) ciopts(lcolor(black black))) ///
		(m7, mcolor(black) ciopts(lcolor(black black))) ///
		(m8, mcolor(black) ciopts(lcolor(black black))) ///
		(m9, mcolor(black) ciopts(lcolor(black black))) ///
		(m10, mcolor(black) ciopts(lcolor(black black))), ///
		vertical ///
		keep(1.treated) ///
		yline(0, lcolor(black) lwidth(thin) lpattern(dash)) ///
		levels(99 95) ciopts(lwidth(*1 *5)) ///
		graphregion(fcolor(white)) bgcolor(white) ///
		legend(off) ///
		ytitle("Effect on attitude towards gays and lesbians (1-5)", margin(r=2)) ///
		xtitle("Income decile", margin(t=2)) ///
		xlabel(0.6 "1" 0.688 "2" 0.776 "3" 0.864 "4" 0.952 "5" 1.04 "6" 1.128 "7" 1.216 "8" 1.304 "9" 1.4 "10", noticks labgap(*3))
		cd ..
		graph export "$figures/figureA32.pdf", replace

		
// Effect of tax day on attitudes towards gays and lesbians by age group

use "ess_finland.dta", clear
cd "$figures"

eststo clear

reg gay i.treated##c.rv i.essround if abs(rv)<=10 & $drop3 & age15_24==1
estimates store m1
reg gay i.treated##c.rv i.essround if abs(rv)<=10 & $drop3 & age25_34==1
estimates store m2
reg gay i.treated##c.rv i.essround if abs(rv)<=10 & $drop3 & age35_44==1
estimates store m3
reg gay i.treated##c.rv i.essround if abs(rv)<=10 & $drop3 & age45_54==1
estimates store m4
reg gay i.treated##c.rv i.essround if abs(rv)<=10 & $drop3 & age55_64==1
estimates store m5
reg gay i.treated##c.rv i.essround if abs(rv)<=10 & $drop3 & age65_74==1
estimates store m6
reg gay i.treated##c.rv i.essround if abs(rv)<=10 & $drop3 & age75_100==1
estimates store m7

coefplot(m1, mcolor(black) ciopts(lcolor(black black))) ///
		(m2, mcolor(black) ciopts(lcolor(black black))) ///
		(m3, mcolor(black) ciopts(lcolor(black black))) ///
		(m4, mcolor(black) ciopts(lcolor(black black))) ///
		(m5, mcolor(black) ciopts(lcolor(black black))) ///
		(m6, mcolor(black) ciopts(lcolor(black black))) ///
		(m7, mcolor(black) ciopts(lcolor(black black))), ///
		vertical ///
		keep(1.treated) ///
		yline(0, lcolor(black) lwidth(thin) lpattern(dash)) ///
		levels(99 95) ciopts(lwidth(*1 *5)) ///
		graphregion(fcolor(white)) bgcolor(white) ///
		legend(off) ///
		ytitle("Effect on attitude towards gays and lesbians (1-5)", margin(r=2)) ///
		xtitle("Age groups (in years)", margin(t=2)) ///
		xlabel(0.635 "15-24" 0.75833 "25-34" 0.8816333 "35-44" 1.004999 "45-54" 1.128333 "55-64" 1.251666 "65-74" 1.375 "75-100", noticks labgap(*3))
		cd ..
		graph export "$figures/figureA33.pdf", replace

		
********************************************************************************
**					APPENDIX: PLACEBO SAMPLE SWEDEN							  **
********************************************************************************				
				
// Effect of tax day by income decile
				
use "ess_finland_sweden.dta", clear
cd "$figures"

drop if finland==1

eststo clear

quietly reg gincdif i.treated##c.rv i.essround if abs(rv)<=10 & $drop3 & hinctnta_combined==1
estimates store m1
quietly reg gincdif i.treated##c.rv i.essround if abs(rv)<=10 & $drop3 & hinctnta_combined==2
estimates store m2
quietly reg gincdif i.treated##c.rv i.essround if abs(rv)<=10 & $drop3 & hinctnta_combined==3
estimates store m3
quietly reg gincdif i.treated##c.rv i.essround if abs(rv)<=10 & $drop3 & hinctnta_combined==4
estimates store m4
quietly reg gincdif i.treated##c.rv i.essround if abs(rv)<=10 & $drop3 & hinctnta_combined==5
estimates store m5
quietly reg gincdif i.treated##c.rv i.essround if abs(rv)<=10 & $drop3 & hinctnta_combined==6
estimates store m6
quietly reg gincdif i.treated##c.rv i.essround if abs(rv)<=10 & $drop3 & hinctnta_combined==7
estimates store m7
quietly reg gincdif i.treated##c.rv i.essround if abs(rv)<=10 & $drop3 & hinctnta_combined==8
estimates store m8
quietly reg gincdif i.treated##c.rv i.essround if abs(rv)<=10 & $drop3 & hinctnta_combined==9
estimates store m9
reg gincdif i.treated##c.rv i.essround if abs(rv)<=10 & $drop3 & hinctnta_combined==10
estimates store m10

coefplot(m1, mcolor(black) ciopts(lcolor(black black))) ///
		(m2, mcolor(black) ciopts(lcolor(black black))) ///
		(m3, mcolor(black) ciopts(lcolor(black black))) ///
		(m4, mcolor(black) ciopts(lcolor(black black))) ///
		(m5, mcolor(black) ciopts(lcolor(black black))) ///
		(m6, mcolor(black) ciopts(lcolor(black black))) ///
		(m7, mcolor(black) ciopts(lcolor(black black))) ///
		(m8, mcolor(black) ciopts(lcolor(black black))) ///
		(m9, mcolor(black) ciopts(lcolor(black black))) ///
		(m10, mcolor(black) ciopts(lcolor(black black))), ///
		vertical ///
		keep(1.treated) ///
		yline(0, lcolor(black) lwidth(thin) lpattern(dash)) ///
		levels(99 95) ciopts(lwidth(*1 *5)) ///
		graphregion(fcolor(white)) bgcolor(white) ///
		legend(off) ///
		ytitle("Effect on support for redistribution (1-5)", margin(r=2)) ///
		xtitle("Income decile", margin(t=2)) ///
		xlabel(0.6 "1" 0.688 "2" 0.776 "3" 0.864 "4" 0.952 "5" 1.04 "6" 1.128 "7" 1.216 "8" 1.304 "9" 1.4 "10", noticks labgap(*3))
		cd ..
		graph export "$figures/figureA34.pdf", replace

		
// Effect of tax day by age group

use "ess_finland_sweden.dta", clear
cd "$figures"

drop if finland==1

eststo clear

reg gincdif i.treated##c.rv i.essround if abs(rv)<=10 & $drop3 & age15_24==1
estimates store m1
reg gincdif i.treated##c.rv i.essround if abs(rv)<=10 & $drop3 & age25_34==1
estimates store m2
reg gincdif i.treated##c.rv i.essround if abs(rv)<=10 & $drop3 & age35_44==1
estimates store m3
reg gincdif i.treated##c.rv i.essround if abs(rv)<=10 & $drop3 & age45_54==1
estimates store m4
reg gincdif i.treated##c.rv i.essround if abs(rv)<=10 & $drop3 & age55_64==1
estimates store m5
reg gincdif i.treated##c.rv i.essround if abs(rv)<=10 & $drop3 & age65_74==1
estimates store m6
reg gincdif i.treated##c.rv i.essround if abs(rv)<=10 & $drop3 & age75_100==1
estimates store m7

coefplot(m1, mcolor(black) ciopts(lcolor(black black))) ///
		(m2, mcolor(black) ciopts(lcolor(black black))) ///
		(m3, mcolor(black) ciopts(lcolor(black black))) ///
		(m4, mcolor(black) ciopts(lcolor(black black))) ///
		(m5, mcolor(black) ciopts(lcolor(black black))) ///
		(m6, mcolor(black) ciopts(lcolor(black black))) ///
		(m7, mcolor(black) ciopts(lcolor(black black))), ///
		vertical ///
		keep(1.treated) ///
		yline(0, lcolor(black) lwidth(thin) lpattern(dash)) ///
		levels(99 95) ciopts(lwidth(*1 *5)) ///
		graphregion(fcolor(white)) bgcolor(white) ///
		legend(off) ///
		ytitle("Effect on support for redistribution (1-5)", margin(r=2)) ///
		xtitle("Age groups (in years)", margin(t=2)) ///
		xlabel(0.635 "15-24" 0.75833 "25-34" 0.8816333 "35-44" 1.004999 "45-54" 1.128333 "55-64" 1.251666 "65-74" 1.375 "75-100", noticks labgap(*3))
		cd ..
		graph export "$figures/figureA35.pdf", replace



********************************************************************************
**				APPENDIX: PLACEBO TREATMENT BEFORE ACTUAL TAX DAY			  **
********************************************************************************				

// FIGURE A36: Effect of various placebo tax days (+/-50 days) on complete sample (including control and treatment observations)

use "ess_finland.dta", clear
cd "$figures"

sum rv

forvalues i = -50(1)50 {
		local j = `i' + 50
		gen rv_`j' = rv + `i'
		gen placebo_treated_`j' = 0
		replace placebo_treated_`j' = 1 if rv_`j' >= 0 & rv_`j' != .

}


forvalues j = 0(1)100 {

		reg gincdif i.placebo_treated_`j'##c.rv_`j' i.essround if abs(rv_`j')<=10
		parmest, saving(`j'.dta, replace)	

}

forvalues j = 0(1)100 {
	use `j'.dta, clear
	gen daysfromtreat = `j'-50
	keep in 2
	save, replace
}


use "0.dta", clear

forvalues i = 1(1)100 {
		append using `i'.dta
}

twoway (rline min95 max95 daysfromtreat, yline(0, lcolor(black) lwidth(vthin)) lpattern(dash) lcolor(gray) lwidth(medium) xlabel(-50(10)50) ylabel(, format(%3.1f)) legend(off) xtitle("Placebo treatment (days before/after tax day)") ytitle(Effect on support for redistribution (1-5)) graphregion(color(white)) xline(0, lcolor(cranberry))) (scatter estimate daysfromtreat, connect(direct) lwidth(medium) lcolor(black) msymbol(none))

graph export "figureA36.pdf", replace

local list : dir . files "*.dta"
foreach f of local list {
    erase "`f'"
}

********************************************************************************

// FIGURES A37-A38

// The fake running variable is centered on 23 days before the tax day, which is the
// empirical mean of the control group (everyone interviewed before the tax day)
// The analysis is done only on observations in the control group

cd ..
use "ess_finland.dta", clear
cd "$figures"

// Mean of control group
tabstat rv if treated==0, s(mean median sd min max)

// Drop all respondents interviewed after tax day (treatment group)
drop if treated==1

// Create fake running variable
gen placebo_rv = rv + 23
order placebo_rv, a(rv)

// Create fake treatment variable
gen placebo_treated = 0
replace placebo_treated = 1 if placebo_rv >= 0 & placebo_rv != .
order placebo_treated, a(placebo_rv)

// Global for dropping 3 days prior to placebo tax day
gl placebo_drop3 "placebo_rv != -3 & placebo_rv != -2 & placebo_rv != -1"

	
// FIGURE A37: Effect of placebo tax day by income decile

eststo clear

reg gincdif i.placebo_treated##c.placebo_rv i.essround if abs(placebo_rv)<=10 & $placebo_drop3 & hinctnta_combined==1
estimates store m1
quietly reg gincdif i.placebo_treated##c.placebo_rv i.essround if abs(placebo_rv)<=10 & $placebo_drop3 & hinctnta_combined==2
estimates store m2
quietly reg gincdif i.placebo_treated##c.placebo_rv i.essround if abs(placebo_rv)<=10 & $placebo_drop3 & hinctnta_combined==3
estimates store m3
quietly reg gincdif i.placebo_treated##c.placebo_rv i.essround if abs(placebo_rv)<=10 & $placebo_drop3 & hinctnta_combined==4
estimates store m4
quietly reg gincdif i.placebo_treated##c.placebo_rv i.essround if abs(placebo_rv)<=10 & $placebo_drop3 & hinctnta_combined==5
estimates store m5
quietly reg gincdif i.placebo_treated##c.placebo_rv i.essround if abs(placebo_rv)<=10 & $placebo_drop3 & hinctnta_combined==6
estimates store m6
quietly reg gincdif i.placebo_treated##c.placebo_rv i.essround if abs(placebo_rv)<=10 & $placebo_drop3 & hinctnta_combined==7
estimates store m7
quietly reg gincdif i.placebo_treated##c.placebo_rv i.essround if abs(placebo_rv)<=10 & $placebo_drop3 & hinctnta_combined==8
estimates store m8
quietly reg gincdif i.placebo_treated##c.placebo_rv i.essround if abs(placebo_rv)<=10 & $placebo_drop3 & hinctnta_combined==9
estimates store m9
reg gincdif i.placebo_treated##c.placebo_rv i.essround if abs(placebo_rv)<=10 & $placebo_drop3 & hinctnta_combined==10
estimates store m10

coefplot(m1, mcolor(black) ciopts(lcolor(black black))) ///
		(m2, mcolor(black) ciopts(lcolor(black black))) ///
		(m3, mcolor(black) ciopts(lcolor(black black))) ///
		(m4, mcolor(black) ciopts(lcolor(black black))) ///
		(m5, mcolor(black) ciopts(lcolor(black black))) ///
		(m6, mcolor(black) ciopts(lcolor(black black))) ///
		(m7, mcolor(black) ciopts(lcolor(black black))) ///
		(m8, mcolor(black) ciopts(lcolor(black black))) ///
		(m9, mcolor(black) ciopts(lcolor(black black))) ///
		(m10, mcolor(black) ciopts(lcolor(black black))), ///
		vertical ///
		keep(1.placebo_treated) ///
		yline(0, lcolor(black) lwidth(thin) lpattern(dash)) ///
		levels(99 95) ciopts(lwidth(*1 *5)) ///
		graphregion(fcolor(white)) bgcolor(white) ///
		legend(off) ///
		ytitle("Effect on support for redistribution (1-5)", margin(r=2)) ///
		xtitle("Income decile", margin(t=2)) ///
		xlabel(0.6 "1" 0.688 "2" 0.776 "3" 0.864 "4" 0.952 "5" 1.04 "6" 1.128 "7" 1.216 "8" 1.304 "9" 1.4 "10", noticks labgap(*3))
		
		graph export "figureA37.pdf", replace

		
// FIGURE A38: Effect of placebo tax day by age group

eststo clear

reg gincdif i.placebo_treated##c.placebo_rv i.essround if abs(placebo_rv)<=10 & $placebo_drop3 & age15_24==1
estimates store m1
reg gincdif i.placebo_treated##c.placebo_rv i.essround if abs(placebo_rv)<=10 & $placebo_drop3 & age25_34==1
estimates store m2
reg gincdif i.placebo_treated##c.placebo_rv i.essround if abs(placebo_rv)<=10 & $placebo_drop3 & age35_44==1
estimates store m3
reg gincdif i.placebo_treated##c.placebo_rv i.essround if abs(placebo_rv)<=10 & $placebo_drop3 & age45_54==1
estimates store m4
reg gincdif i.placebo_treated##c.placebo_rv i.essround if abs(placebo_rv)<=10 & $placebo_drop3 & age55_64==1
estimates store m5
reg gincdif i.placebo_treated##c.placebo_rv i.essround if abs(placebo_rv)<=10 & $placebo_drop3 & age65_74==1
estimates store m6
reg gincdif i.placebo_treated##c.placebo_rv i.essround if abs(placebo_rv)<=10 & $placebo_drop3 & age75_100==1
estimates store m7

coefplot(m1, mcolor(black) ciopts(lcolor(black black))) ///
		(m2, mcolor(black) ciopts(lcolor(black black))) ///
		(m3, mcolor(black) ciopts(lcolor(black black))) ///
		(m4, mcolor(black) ciopts(lcolor(black black))) ///
		(m5, mcolor(black) ciopts(lcolor(black black))) ///
		(m6, mcolor(black) ciopts(lcolor(black black))) ///
		(m7, mcolor(black) ciopts(lcolor(black black))), ///
		vertical ///
		keep(1.placebo_treated) ///
		yline(0, lcolor(black) lwidth(thin) lpattern(dash)) ///
		levels(99 95) ciopts(lwidth(*1 *5)) ///
		graphregion(fcolor(white)) bgcolor(white) ///
		legend(off) ///
		ytitle("Effect on support for redistribution (1-5)", margin(r=2)) ///
		xtitle("Age groups (in years)", margin(t=2)) ///
		xlabel(0.635 "15-24" 0.75833 "25-34" 0.8816333 "35-44" 1.004999 "45-54" 1.128333 "55-64" 1.251666 "65-74" 1.375 "75-100", noticks labgap(*3))
		
		graph export "figureA38.pdf", replace


********************************************************************************
**								RDD RESULTS									  **
********************************************************************************				

cd ..
use "ess_finland.dta", clear

** FIGURE A2: RD type plot of support for redistribution (binned by day relative to tax day)

bysort rv: egen av_gincdif = mean(gincdif)

twoway 	(lfitci gincdif rv if rv >= -30 & rv <=0, ciplot(rline) blpattern(dash) lcolor(black)) ///
		(lfitci gincdif rv if rv >= 0 & rv <=30, ciplot(rline) blpattern(dash) lcolor(black))  ///
		(scatter av_gincdif rv if abs(rv)<=30, mcolor(gs12) xlabel(-30(5)30) legend(order(2 "Linear fit" 5 "Mean support for redistribution (daily bins)")) ///
		xtitle("Days before / after the tax day") ytitle(Support for redistribution (1-5)) ylabel(3.5(0.2)4.3) yscale(range(3.5 4.3)) graphregion(color(white)) xline(0, lcolor(black)))
		
		graph export "$figures/figureA2.pdf", replace


/*
** Density test to test whether running variable discontinuous at the tax day
********************************************************************************

// Non-parametric density test (Cattaneo et al., 2018)
rddensity rv, c(0)

// Create dummies for each ESS round (rdrobust does not support factor variable notation)
tabulate essround, generate(round)

** RDD to show that 10-day bandwidth is very close to MSE-optimal
********************************************************************************

// RDD on support for redistribution (full sample, all income deciles)

* RD baseline
rdrobust gincdif rv, all

* RD baseline controlling for survey round
rdrobust gincdif rv, all covs(round1-round8)

* RD with clustered SEs at interview-date level
rdrobust gincdif rv, all covs(round1-round8) vce(cluster intdate)
*/

// Close log

log close
